主要使用oracle 11g中提供的unpivot实现,其用法见官网:
http://www.oracle.com/technetwork/articles/sql/11g-pivot-097235.html
http://www.oracle.com/technetwork/articles/sql/11g-pivot-097235.html
示例:
select *
from (select '10' day10, '15' day15, '12' day12 from dual)
unpivot
(
state_counts
for state_code in ("DAY10", "DAY15", "DAY12")
)
order by state_code;