How can I retrieve accounts that haven't done anything within the last 30 days?
Posted on 2016-10-22
I've got a table with a column called "created."
I want to retrieve all the rows in the table that constitute an account that hasn't made a payment within the last 30 days.
Right now, I'm using a SELECT statement that looks like this:
WHERE t.accountid IN
FROM Account ac
com.ended IS NULL
t.payer='P' AND type='P'
AND cg.status1 IN ('AC','DF', 'PP')
How would I incorporate a CASE that looked to see if any activity has occurred within the last 30 days? Right now, I'm getting a recordset that shows me everything that has happened within the last month, but I need to know all of what SHOULD HAVE happened this month, that didn't happen.
I'm thinking something along the lines of looking at a particular account and see if the "created" date is within the last 30 days. If so, I don't need that in the recordset. If not, that's what I need listed.
How would I pull that off?