Select records from NOW() -1 Day

user1092780 picture user1092780 · Dec 17, 2011 · Viewed 253.5k times · Source

Is there a way in a MySQL statement to order records (through a date stamp) by >= NOW() -1 so all records from the day before today to the future are selected?

Answer

Jon Skeet picture Jon Skeet · Dec 17, 2011

Judging by the documentation for date/time functions, you should be able to do something like:

SELECT * FROM FOO
WHERE MY_DATE_FIELD >= NOW() - INTERVAL 1 DAY