从 NOW() -1 天中选择记录

2021-12-19 00:00:00 select where mysql datestamp

有没有办法在 MySQL 语句中按 >= NOW() -1 对记录进行排序(通过日期戳),以便选择从前一天到未来的所有记录?

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?

推荐答案

根据 日期/时间函数的文档,您应该能够执行以下操作:

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

相关文章