Hi,
I'm wondering if it's possible to pivot a table without having to use aggregate functions?
I'm using MS SQL 2000. Basically, i want to have my table normalized but use a query to pivot it.
e.g.:
Table in database:
name A B
---- ---- ----
X 1 1
Y 1 0
Z 0 0
I want to use a query to get the data as:
X Y Z ...
A 1 1 0 ...
B 1 0 0 ...
I can only find examples of such queries using an aggregate function like SUM which ends up adding up the 1's in my table.
Need it to be independent of the number of columns/rows too.
Any suggestions?
Thanks
I'm wondering if it's possible to pivot a table without having to use aggregate functions?
I'm using MS SQL 2000. Basically, i want to have my table normalized but use a query to pivot it.
e.g.:
Table in database:
name A B
---- ---- ----
X 1 1
Y 1 0
Z 0 0
I want to use a query to get the data as:
X Y Z ...
A 1 1 0 ...
B 1 0 0 ...
I can only find examples of such queries using an aggregate function like SUM which ends up adding up the 1's in my table.
Need it to be independent of the number of columns/rows too.
Any suggestions?
Thanks