var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Return Dates in a Range
I am trying to return a list of the dates that are found in date ranges in a result set.
For example, I have a reservations table that has a res_start column and a res_end column. I want to run a query that returns all the dates that fall into any of the ranges returned. Is this possible?
Important: I don't want to return a range, I want all the individual dates that fall in any of the ranges. I am using the dates in an availability table.
Thanks for any direction you can give.
see this thread and create a numbers table with as many numbers as the longest date range
then change the query as follows --
the line marked important is where you select which reservation you want to generate the dates for
SELECT r.res_start + INTERVAL n DAY AS my_date
FROM reservations AS r
WHERE r.somekey = somevalue -- THIS LINE IS IMPORTANT
AND r.res_start + INTERVAL n DAY <= r.res_end
...and from your numbers table you can create a calendar table too