开发者

select all events within the next hour

In my MySQL database, there is a table, where I store daily rec开发者_JAVA百科urring events.

I store the time of the event in the field time, that has the 'TIME' type. How do I select all events within the next hour?


Try this:

SELECT *
FROM your_table
WHERE TIMEDIFF(`time`,TIME(NOW())) < TIME('01:00:00');


Something like this:

TIMEDIFF(event.time, TIME(NOW())) < TIME('01:00:00')

See MySQL date/time functions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜