I have some data that looks like this:
Table1
Number TYPE Acct Total
------ --- --- ----
1X2 GGG 111 100
1X2 GGG 222 200
What I'm trying to do is PIVOT this data so that it looks like this:
Number Type 111 222
----- --- --- ---
1X2 GGG 100 200
Here's how I pivot:
Select * from Table1
PIVOT (MAX(Total)
FOR ACCT in ([111],[222],[333])
Now this works very well for Acct 111 and 222, but for 333 the Total = NULL. Thing is here, that I might sometimes have all three ACCTs, as in 111, 222, and 333. Other times as shown in the above example one of them might be missing.
Anywho, when I do my pivot the data looks like this:
Number Type 111 222 333
----- --- --- --- ---
1X2 GGG 100 200 NULL <-- I'm trying to set this to 0
As you can see, the Value for 333 is NULL - IS there anyway I can set this value to 0?
