I don't really see why my suggestion wouldn't work. You could see the time period as two per day. The first one would be from the beginning of the day until the end_time and the second period would be after the start_time and until the end of the day. Therefore, this should return either if the current time is less than the end_time or greater than the start_time. So only one condition must be met.

If you use this:

Code:

SELECT * FROM table WHERE (start_time < CURRENT_TIME()) OR (end_time > CURRENT_TIME());

and your start_time is 21:00:00 and your end_time is 03:00:00 then it will be:

Code:

SELECT * FROM table WHERE (**21:00:00 < CURRENT_TIME()**) OR (**03:00:00 > CURRENT_TIME()**);

You can then look at some of the different possibilities for current_time:

**01:00:00 - returns** because **second criterion** is met (03:00:00 > 01:00:00)**02:00:00 - returns** because **second criterion** is met (03:00:00 > 02:00:00)**02:59:59 - returns** because **second criterion** is met (03:00:00 > 02:59:59)- 03:00:00 - does not return because no criterion is met
- 04:00:00 - does not return because no criterion is met
- 05:00:00 - does not return because no criterion is met
- 06:00:00 - does not return because no criterion is met
- 07:00:00 - does not return because no criterion is met
- 08:00:00 - does not return because no criterion is met
- 09:00:00 - does not return because no criterion is met
- 10:00:00 - does not return because no criterion is met
- 11:00:00 - does not return because no criterion is met
- 12:00:00 - does not return because no criterion is met
- 13:00:00 - does not return because no criterion is met
- 14:00:00 - does not return because no criterion is met
- 15:00:00 - does not return because no criterion is met
- 16:00:00 - does not return because no criterion is met
- 17:00:00 - does not return because no criterion is met
- 18:00:00 - does not return because no criterion is met
- 19:00:00 - does not return because no criterion is met
- 20:00:00 - does not return because no criterion is met
- 21:00:00 - does not return because no criterion is met
**21:00:01 - returns** because **first criterion** is met (21:00:00 < 21:00:01)**22:00:00 - returns** because **first criterion** is met (21:00:00 < 22:00:00)**23:00:00 - returns** because **first criterion** is met (21:00:00 < 23:00:00)**24:00:00 - returns** because **first criterion** is met (21:00:00 < 24:00:00)**00:00:00 - returns** because **second criterion** is met (03:00:00 > 00:00:00)

I wasn't sure if it's 24:00:00 or 00:00:00 but as you can see, this should work as you need it to work.

## Bookmarks