I have a table that contains dates, the table can have multiple dates in it. For Example
Date
'2011-01-01'
'2011-03-01'
'2011-06-01'
'2011-11-01'
'2011-12-01'
I also have a table that just has units in it. There will never be duplicate units.
Unit
1
2
3
4
5
6
How do I return all dates for every unit. For example:
Unit Date
1 '2011-01-01'
1 '2011-03-01'
1 '2011-06-01'
1 '2011-11-01'
1 '2011-12-01'
2 '2011-01-01'
2 '2011-03-01'
2 '2011-06-01'
2 '2011-11-01'
2 '2011-12-01'
and so on…..
Using
CROSS JOINhttp://msdn.microsoft.com/en-us/library/ms190690.aspx
Query assumes
Datecolumn is inDate_Table, andUnitcolumn is inUnit_Table