```WHERE master.id IN ( SELECT DISTINC...
# suiteql
c
Copy code
WHERE
    master.id IN (
        SELECT DISTINCT tran.entity
        FROM transaction tran
        WHERE tran.trandate > CURRENT_DATE - 1
    )
Adding this to my query gives this error Column:CURRENT_DATE not found. Any idea why?
s
Try: TO_DATE(CURRENT_DATE)
c
Copy code
WHERE tran.trandate > TO_DATE(CURRENT_DATE - 1)
Like this?
] Column:CURRENT_DATE not found.[
s
Yes, sorry the -1 was on the next line and I missed that. TO_DATE(CURRENT_DATE - 1)
c
Same error
CURRENT_DATE works elsewhere in the query so not sure why it has a problem in this where
s
Hmm yeah I use CURRENT_DATE a lot, always in TO_DATE() but it also always works 🤔
c
My dirty way of fixing this is to use a separate query to work out which customers have recent transactions (last 24 hours) then pass in a list of IDs to this larger query.
Copy code
WHERE
    master.id IN (CUSTOMER_ID_ARRAY)
That's is a questionable workaround but it stops me having to mess with this massive query too much.