This is probably dead easy, but I just can't engage my brain this morning.
I have a table that looks something like the below (some fields omitted, but they aren't relevant)
Code:
+----+------------+------------+-------+
| id | startdate | enddate | flags |
+----+------------+------------+-------+
| 1 | 2014-05-17 | 2014-05-24 | 1 |
| 2 | 2014-05-22 | 2014-05-29 | 4 |
+----+------------+------------+-------+
Basically, I want to return the number of days in any given row that fall between a user specified date range.
So, for example, if the user enters a startdate of 2014-05-13 and an enddate of 2014-05-19, that will match row id 1, and the query should tell me that there are three days that match the user's date range (17th, 18th, 19th)
Is that even possible?