I want to find if a record in the database has overlapping date range as compared to a date range I have on hand.
If the database has a record with a startDateTime of 2011-05-19 10:00:00 and endDateTime of 2011-05-19 11:00:00.
If I have a date range of startDateTime of 2011-05-19 09:30:00 and endDateTime of 2011-05-19 10:30:00.
or my date range is startDateTIme 2011-05-19 10:30:00 and endDateTime of 2011-05-19 11:30:00.
How can I search the database in such a way that I do not get any records if the date/time do not overlap with the date/time I have on hand.
WHERE table.startDateTime < '$endDateTime'
AND table.endDateTime > '$startDateTime'