[英]gets rows from mysql where row elements date is between now & 5 days from now
I know this has prob been answered, but I've searched for almost an hour now and Im not finding my answer.我知道这已经被回答了,但我已经搜索了将近一个小时,但我没有找到我的答案。
Here is my sql query.这是我的 sql 查询。
SELECT *
FROM (`calendar_event`)
WHERE DATE_FORMAT(`start_time`, '%m/%d/%Y')
BETWEEN CURDATE() + INTERVAL 5 DAY AND CURDATE()
Here is the format of the start_time
column 06/30/2011 8:30 AM这是
start_time
列的格式 06/30/2011 8:30 AM
The query isn't having any errors, Im just not getting any results...查询没有任何错误,我只是没有得到任何结果......
BETWEEN a AND b
needs b
to be greater than a
, otherwise the interval is empty. BETWEEN a AND b
需要b
大于a
,否则区间为空。
Try inverting the two date parameters you're building.尝试反转您正在构建的两个日期参数。
Try this: WHERE date_col BETWEEN 'date1' and 'date2'试试这个: WHERE date_col BETWEEN 'date1' and 'date2'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.