有没有办法在 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
这篇关于从 NOW() -1 天中选择记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!