I'm trying to create a SQL query (for MySQL) that will return all events that take place on a particular date.
So far, Ive done the obvious, and compiled the following:
SELECT * FROM events WHERE start_date>='20060720' AND finish_date2<='20060724'
(Dates are year/month/day)
This works great if the start date and end date fall between these two dates.
However, let's assume that the start date of an event is 20060719, and the finish date is 20060725. The event is obviously taking place in the original SQL query, however, it won't return the event, as it appears to fall outside the dates specified.
What I would like to do is to turn the SQL around so that it would read...
SELECT * FROM events WHERE 20060723 BETWEEN start_date AND finish_date
...which cannot be done, obviously.
Does anyone have a solution to this problem?
Thanks a bunch, in advance.