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.
精彩评论