This question already has an answer here:
- Need help with SQL Server PIVOT 1 answer
I have a table with 22,000 records formatted like so:
[ID],[Cost Center],[Function] 1,01A1001710,GF000001 2,01A1001710,GF000802 3,02R1012000,GF000001 4,02R1012000,GF000059 5,02R1012000,GF000013
What I would like to do is append these to a new table formatted like so:
[Cost Center], [Node1], [Node2], [Node3], [Node4], [Node5], [Node6] 01A1001710,GF000001,GF000802 02R1012000,GF000001,GF000059,GF000013
What is unknown is the number of [Function] per [Cost Center] it could range from a single function to a maximum of 6.
I tried to pivot but wound up with 60 different columns representing [Function]