oracle how to transpose columns into rows without UNION

前端 未结 1 1549
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 15:50

Assume, i have 4 columns in a table

id | col1 | col2 | col3 

now i want to transpose that into one column but in 4 rows:

resul         


        
相关标签:
1条回答
  • 2021-01-25 16:34

    This can be done using unpivot.

    select result 
    from tablename
    unpivot (result for colnames in (id,col1,col2,col3))
    
    0 讨论(0)
提交回复
热议问题