<p>I have a table of events with a recorded start and end time as a MySQL DATETIME object (in the format <code>YYYY-MM-DD HH:MM:SS</code>. I want to find all events that occur in a specific date range. However, events can span multiple days (and go outside of my date range, but I want to return them if they even overlap by 1 second or more with my date range).</p>

<p>Suggestions?</p>

```
```
SELECT *
FROM table
WHERE startdate >= 'starting date' AND startdate < 'ending date'
    OR enddate >= 'starting date' AND enddate < 'ending date'
```
```
should work for you.
Make sure you specify 'starting date' and 'ending date' with the time included.
```
```
'2008-01-01 00:00:00'' AND '2008-01-31 23:59:59'
```
```
This will help to avoid errors where dates are the same, but your time falls within the interval by a few hours, minutes, or seconds.