SQL: “Reverse” transpose a table

前端 未结 2 738
南笙
南笙 2021-01-25 11:20

I saw a lot of questions on transposing from the below table...

scanid | region | volume
-------------------------
1          A      34.4
1          B      32.1
         


        
2条回答
  •  再見小時候
    2021-01-25 12:07

    You could do this very simply with a UNION clause:

    Select Scan_ID, 'A' as Region, A_Volume as volume
        union all
    Select Scan_ID, 'B' as Region, B_Volume as volume
        union all
    Select Scan_ID, 'C' as Region, C_Volume as volume
    

提交回复
热议问题