I never remember how to do this properly -开发者_开发百科 can you help me fix this query?
SELECT * from log where now() - EventTime < '1 day'
Note - this question seems identical but there's no solution there for mysql.
SELECT * FROM log WHERE EventTime >= DATE_SUB(CURDATE(), INTERVAL 1 DAY);
SELECT * FROM log WHERE SUBDATE(NOW(), 1) < EventTime
Or to only select the ones from today:
SELECT * FROM log WHERE DATE(NOW()) = DATE(EventTime)
精彩评论