我有这个问题:
SELECT * FROM booking WHERE '$year/$month/$day' BETWEEN arrivalDate AND departureDate
其中arrivalDate和departureDate是我的表格列中的日期值。
如何在出发前一天检查日期?
IE:departureDate - 1天
答案 0 :(得分:4)
你几乎就在那里,有 - INTERVAL 1 DAY
:
SELECT * FROM booking WHERE '$year/$month/$day' BETWEEN arrivalDate AND departureDate - INTERVAL 1 DAY
另见: