I got a mysql table with columns from_date and to_date.
I also got a second timespan in PHP consisting of $monday and $friday.
Now I want to select all entries from my table which’s timespan includes atleast one day inbetween $monday and $friday.
I first thought about something like this:
WHERE `from_date` >= :monday
AND `to_date` <= :friday
But this would not include entries where from_date is smaller then :monday or to_date is greater then :friday
I think you want to select records which start before the end of your range and end after the start of it: