I have a table that looks as follows
ID | value1 | value2 | value3
1 | 5 | 6 | 7
2 | 10 | 11 | 12
3 | 20 | 21 | 22
I need to create one row for each of the 3 value columns per ID
. The final table should look like this (the column headers dont make sense anymore, but you can ignore this):
ID | value1 | value2
1 | value1 | 5
1 | value2 | 6
1 | value3 | 7
2 | value1 | 10
2 | value2 | 11
2 | value3 | 12
3 | value1 | 20
3 | value2 | 21
3 | value3 | 22
What would be the best way to approach this in TSQL?