
April 4th, 2012, 09:21 AM
|
 |
Business Analyst
|
|
Join Date: Mar 2004
Location: The 'Ville
|
|
|
Outer join on month/year
I have a query like
Code:
select datepart(yyyy, mydate), datepart (mm, mydate), sum(myvalue)
that returns something like this:
2011 1 5
2011 2 8
2011 3 4
2011 5 7
There are no records in the table for April (4), as you can see. Normally I would do an outer join on a table to make sure that I return a record like "2011 4 0" but I'm not sure how to accomplish this when there is no real table to join against. I don't want to use a temp table because I'd like it to be a "self-contained" query.
Any ideas?
Thanks!
__________________
Discontent is the first necessity of progress. - Edison
|