records from yesterday in postrgesql

postgresql

Solution

WHERE workorder.createdtime > current_date - 1     -- Yesterday and today

WHERE workorder.createdtime > current_timestamp - interval '1 day' -- last 24hr

Problem

I have an application in which I've used MySQL. I had a report that stretched records of the last 24 hours. I used the query: ``` WHERE (DATE_SUB(CURDATE(), INTERVAL 1 DAY) <= FROM_UNIXTIME(`workorder`.`CREATEDTIME` / 1000)) ``` Now I have to use PostgreSQL and do not know how to make a report of the last 24 hours. Can any of you help?

Original source