开发者

Select log lines from today in mysql

开发者 https://www.devze.com 2023-01-02 07:38 出处:网络
I never remember how to do this properly -开发者_开发百科 can you help me fix this query? SELECT * from log where now() - EventTime < \'1 day\'

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)
0

精彩评论

暂无评论...
验证码 换一张
取 消