SQL Server pivots? some way to set column names to values within a row
Posted
by
ccsimpson3
on Stack Overflow
See other posts from Stack Overflow
or by ccsimpson3
Published on 2012-07-02T20:05:49Z
Indexed on
2012/07/02
21:16 UTC
Read the original article
Hit count: 212
I am building a system of multiple trackers that are going to use a lot of the same columns so there is a table for the trackers, the tracker columns, then a cross reference for which columns go with which tracker, when a user inserts a tracker row the different column values are stored in multiple rows that share the same record id and store both the value and the name of the particular column.
I need to find a way to dynamically change the column name of the value to be the column name that is stored in the same row.
i.e.
id | value | name
------------------
23 | red | color
23 | fast | speed
needs to look like this.
id | color | speed
------------------
23 | red | fast
Any help is greatly appreciated, thank you.
© Stack Overflow or respective owner