Is there a way using Pivot to include rows for which no records exist and show 0s or nulls for the results?
I want the reults of the query to look something like this :-
A B C D
5 12 81 107 0
4 0 0 0 0
3 1 12 12 5
2 3 0 0 0
1 0 0 0 0
However, currently Pivot is not returning empty rows and my results look like this :-
A B C D
5 12 81 107 0
3 1 12 12 5
2 3 0 0 0
Any way that this can be achieved with by doing a sort of ‘left outer join’ on the Pivot to show all rows?
You really need to manufacture the missing records using a cross product and a left join in order to have them appear