My table has events with start and end dates. I need to select only the events for the coming weekend.
For events of the upcoming week I can just use as it’s just the same as the selection for today.
SELECT * FROM table WHERE startdate <= CURDATE() AND enddate >= CURDATE()
How can I select only the events for the upcoming weekend?
2
Answers
You can calculate next Saturday and Sunday using
weekday
function and some math:And
where
clause will look like (ref):