Using SQL Server 2005.
I have a table with calendar months
Month, fiscalorder
june,1
july,2
..
may,12
And another table with employees and a repeating monthly amount
employee, month, amount
john, july, 10
john, july, 3
john, august,2
mary, june, 2
mary, feb, 5
I need to join and aggregate these by month, but every month (even months without data) to report for every employe, but employee then fiscal order.
Output:
june, john, 0
july, john, 13
august,john,2
sept, john, 0
..
june,mary,2
Assuming Sql Server 2005+