Reputation: 36839
I need to find all records that are exactly 3months old in Postgres
My query looks as follows.
SELECT * FROM adds WHERE adtype = 'CL' AND DATEDIFF(dstart,DATE(now())) = DATE_SUB(curdate(),interval 3 month);
But this does not seem to work. Any advise help with this query will be helpful. I can calculate this in PHP but want to find out the value using a Postgres query.
Upvotes: 0
Views: 377
Reputation: 33678
I'd suggest: WHERE DATE(dstart) = DATE(NOW())-INTERVAL '3 month'
Upvotes: 1