SQL Server convert columns to rows

后端 未结 4 1656
挽巷
挽巷 2020-12-10 18:08

I have a sql table with current value and previous value.

Id  Value1  PValue1 Value2  PValue2
1   A       A       V       V1
2   B       B1      W       W1
3         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 18:30

    Finally, and for completeness, there is an UNPIVOT command. However, since you have two columns you want to unpivot, it'd probably be simpler to use one of the other solutions.

提交回复
热议问题