MySQL Query two date values, determine if between submitted date range
Posted on 2014-04-08
I have two date fields in a table, checkInDate and checkOutDate. I have a web form that sends a startdate and enddate. I need to build a query (or sp?) that will do a couple things:
- pull records from my Totes table if the range between totes.checkInDate and totes.checkOutDate somehow intercepts the range between form.startdate and form.enddate;
- calculate the number of days in the range between totes.checkInDate and totes.checkOutDate fall into the range between form.startdate and form.enddate
The Totes table is very simple:
binID, checkInDate, checkOutDate, customerID
Any help is greatly appreciated.