I have the following query to display sales report in each year and month
SELECT
YEAR(orderDate) as SalesYear,
MONTH(orderDate) as SalesMonth,
SUM(Price) AS TotalSales
FROM Sales
GROUP BY YEAR(orderDate),MONTH(orderDate)
ORDER BY YEAR(orderDate), MONTH(orderDate)
output
2013 2 350.00
2013 5 350.00
2014 8 30.00
2014 11 30.00
2015 1 350.00
2015 8 120.00
But I need? output like:
2013 2 700.00
2014 2 60.00
2015 2 470.00
Note: The month part should be the total number of months in each year.
Any help? Thanks in Advance.