开发者

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.

SELECT *
FROM (`calenda开发者_开发百科r_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

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.

Try inverting the two date parameters you're building.


Try this: WHERE date_col BETWEEN 'date1' and 'date2'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜