oracle 12c中
select 1 a,2 b,3 c,4 d, 5 e from dual; 得到一行数据多列,先转换成这样的结果,
想把这样的一行数据转换成后面的形式,请教:如何写sql
a b c d e
1 2 3 4 5
name value
a 1
b 2
c 3
d 4
e 5
最简单的用union all
select 'a' name,xx.a value as from xx where xx.a=1
union all
select 'b',xx.b from xx where xx.a=2
..
.
.
.
..
.
.