Problem:
I currently have a script returning 3 columns (key, date, CountRows):
Each key has a start and end date. I want all dates to be returned regardless if the countRows is 0 because there is no data for that date e.g. there are two missing dates between rows 10 and 11.
My Attempt:
I wrote a left join like:
SELECT c.calendarDate, x.*
FROM Calendar c
LEFT JOIN (SELECT key,
orderDate,
keyStartDate,
keyEndDate,
count(*)
FROM multiple tables
GROUP BY ...) x
ON c.date >= x.startDdate
AND c.date < DATEADD(DD,1,x.endDate)
Output:
However no rows are returned for dates in the range with no orders. I wish to return all such dates on orderDate with a count(*) of 0.

