问题
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:
result
-------
someid
col1data
col2data
col3data
How can i achieve that? Thanks!
回答1:
This can be done using unpivot
.
select result
from tablename
unpivot (result for colnames in (id,col1,col2,col3))
来源:https://stackoverflow.com/questions/39450776/oracle-how-to-transpose-columns-into-rows-without-union