Jump to content

MySQL SELECT using INTERVAL


skyrice

Recommended Posts

Hi there. I have a table that lists events along with their start time in a DATETIME field and their duration in two INT fields, one for hours and one for minutes. I'm trying to SELECT any events in this table that are happening in the future or are currently in progress. What I'm trying to do makes more sense if you look at this SQL query I'm making, but it doesn't work because it's not correct. How can I reform this query to do what I need? Thanks in advance.

SELECT * FROM events
WHERE date >= NOW() + INTERVAL events.hours HOUR + INVERVAL events.minutes MINUTE;
Link to comment
https://forums.phpfreaks.com/topic/36388-mysql-select-using-interval/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.