masterdineen
Aged Yak Warrior
United Kingdom
550 Posts |
Posted - 01/29/2013 : 12:38:28
|
Hello there
i want to create a pivot for a metrics table.
but i have lots of headings, is there a way i can do the following if possible. Below is an example of what i have at the moment.
select client_ref, [15],[766],[771],[772],[773],[774],[775],[776] lots lots more
from(
select tickets.client_ref , tickets.occasionid, tickets.transactionid from Ticket_Facts tickets) as query
pivot(
Count(transactionid) for occasionid in ([15],[766],[771],[772],[773],[774],[775],[776],[777],[778])) as piv
is there a way i could do the following
select client_ref, (select ref from [view]) as client_ref from(
select tickets.client_ref , tickets.occasionid, tickets.transactionid from Ticket_Facts tickets) as query
pivot(
Count(transactionid) for occasionid in (select ref from [view])) as piv
just want to cut down all the listing. |
|