Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要写一个我还不太清楚的查询。
我有一张有 2 个日期的桌子。其中一个是创建日期,另一个是返回日期。我想选择所有行
WHERE date_creation = CURDATE() OR date_return = exactly 14 days ahead.它不必按小时精确,因为它是一个 cronjob 并且每天运行一次。
WHERE date_creation = CURDATE() OR date_return = exactly 14 days ahead.
我曾尝试使用INTERVAL + - DAYS,等。但似乎 INTERVAL 选择了该范围内的所有内容。我需要一些确切的东西。
INTERVAL + - DAYS,
希望有人可以帮助我。
干杯!
you can use this WHERE date_creation = CURDATE() OR date_return = DATE_ADD(CURDATE(), INTERVAL 14 DAY); https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_adddate