Forum Moderators: open
Jan 0
feb 10
Mar 20
Apr 0
May 50
Jun 10
Jul 10
Aug 0
Sep 0
Oct 9
Nov 33
Dec 22
The Query I have at the moment is
SELECT MONTH(Datecomplete) AS MONTHNO, DATENAME(month,DateComplete) AS MonthComplete, SUM(Price*QTY) AS Total
FROM OrderParts INNER JOIN
Orders ON OrderParts.OrderID = Orders.OrderID
WHERE AND YEAR(DateComplete)=@Year
GROUP BY MONTH(Datecomplete),DATENAME(month,DateComplete)
ORDER BY MONTHNO
Any help would be appriciated
MonthID Name
1 jan
2 feb
3 mar
etc.
Then use an outer join to include all rows from the month table and a case select rule for any months with no data.
could you give me an example of how to code a union with the month numbers hard coded.
Thanks again for your help