Avatar of thinklings
thinklings

asked on 

TSQL - Select columns as row values

I have a table that looks similar to the below:

UserID         Column1    Column2   Column3
1                   10                20              30
2                   40                50              60
3                   70                80              90
4                   100              110            120

I would like to run a select query that grabs the table data in the format below:

UserID     Column         Value
1                Column1       10
1                Column2       20
1                Column3       30
2                Column1       40
2                Column2       50
2                Column3       60
3                Column1       70
3                Column2       80
3                Column3       90
4                Column1       100
4                Column2       110
4                Column3       120
Microsoft SQL ServerSQL

Avatar of undefined
Last Comment
PortletPaul

8/22/2022 - Mon