I a having issues grouping the query below into monthly aggregate. Table is cross joined with a table to pick up the rate and inner joined with another that contains just dates to show nulls for dates where data doesnt exist in the table (Client Request) It works fine with the daily grouping which is below. Please how can I group it monthly.
Select * from(select [Letter_Date] [Date],Council
SUM([Total_Corr])*[Rate][Total]
FROM Correspondence
cross join
Input_Variable_Price
where [Revenue_Name] = 'Correspondence'
group by [Letter_Date],Council)AS ED
RIGHT JOIN
(Select '21'[No],b_date,[Revenue_Name][Report],[Unit],[Rate]
From Blank_dates
cross join
Input_Variable_Price
where [Revenue_Name] = 'Correspondence') AS BD
ON ED.Date = BD.[b_date]
Cheers