I am using the following query in an ssrs line chart. It counts how many orders are recorded each month based on each order date.
My problem is that when a month has
You need a table containing months in order to make this work (or you can use a stored procedure or probably common table expression).
SELECT Months.Month, COUNT(Orders.OrderID)
FROM
Months
LEFT OUTER JOIN
Orders
ON
MONTH(Orders.OrderDate) = Months.Month
Would ensure you got:
Month, Count
1, 1
2, 1
3, 2
4, NULL
etc