Hi

Can anybody expand on this code to include zero's for the missing months

http://www.sqlhacks.com/index.php/Dates/GroupByMonth

If you have a look at the heading on the page (at the bottom) "Right way of grouping by month in SQL Server" It only returns a result list for months that have units sold. but how about including all months.. e.g.

Code:
Year        Month       Units sold
----------- ----------- ---------------------------------------
2004        1           0.00
2004        2           6.00
2004        3           5.00
After doing some googling i read that I need to join to another table containing a list of all the months? But do I also need a table with all the years?


I am using MySQL