I have a table of events with a recorded start and end time as a MySQL DATETIME object (in the format YYYY-MM-DD HH:MM:SS. I want to find all events that occur
Basically, you can use regular comparisons -- the ones above should work -- the trick is to check all the different cases that can occur.
A) events with an ending date within the range
B) events with a starting date within the range
C) events with both starting and ending dates within the range
D) events with both starting and ending dates outside the range, but overlapping it
Robert's answer is a good one, but it doesn't take into account case D, where the event starts before the range and ends after the range.