Morning all.
I have a query that I really want to pivot in output. I've looked at everything and I really can't see where this is going wrong...
My query looks like the following:
I've run the actually query unpivoted and get the correct results but it just won't pivot.
Result example from the middle query:
Any thoughts? Am tempted to bash head against wall at this point......
Fee
"The cure for anything is salt water – sweat, tears, or the sea." Isak Dinesen
I have a query that I really want to pivot in output. I've looked at everything and I really can't see where this is going wrong...
My query looks like the following:
Code:
select CCGHB, Brand from
(
-- actually query by yer)
) pvt
pivot
(sum(TotalNIC) for
MQT in ([Feb 13],[May 13],[Aug 13],[Nov 13])) as Value
Result example from the middle query:
Code:
CCGHB Brand MQT TotalNIC
NHS BEXLEY CCG Decapeptyl Feb 13 207
NHS BEXLEY CCG Prostap DCS Feb 13 23324
NHS BEXLEY CCG Zoladex Feb 13 73220
NHS BEXLEY CCG Decapeptyl May 13 207
NHS BEXLEY CCG Prostap DCS May 13 29419
NHS BEXLEY CCG Zoladex May 13 78635
NHS BEXLEY CCG Prostap DCS Aug 13 25205
etc...
Any thoughts? Am tempted to bash head against wall at this point......
Fee
"The cure for anything is salt water – sweat, tears, or the sea." Isak Dinesen