My question is related to these 2 questions:
- https://stackoverflow.com/questions/17529860/how-to-list-all-dates-between-two-dates/27319120
- https://stackoverflow.com/questions/1378593/get-a-list-of-dates-between-two-dates-using-a-function
However in my case, I have a table with an ID,StartDate,EndDate columns and I want to apply the same approach (but instead of 2 days, I want to use the entire table).
And before dropping into functions, I wanted to see if this is possible w/ a select and a date dimension table.
Basically I want to scale this up to the entire table:
SELECT
t.Id
,dd.[Date]
FROM dbo.DateDimension dd
,dbo.T1 t
WHERE
t.Id = 957
and dd.Date>=t.StartDate and dd.Date <= t.EndDate
I have Sample Data + Desired Output (The Select Statement) here:
www.sqlfiddle.com/#!18/0e389/2