表 1
id name num1,num2,num3
1 czf 1 2 3
要转化为
id name num
1 czf 1
1 czf 2
1 czf 3
方法一:
id name num1,num2,num3
1 czf 1 2 3
要转化为
id name num
1 czf 1
1 czf 2
1 czf 3
方法一:
1
select
ID, name, num1
from
tab
2
3 union all
4
5 select ID, name, num2 from tab
6
7 union all
8
9 select ID, name, num3 from tab
方法二:
2
3 union all
4
5 select ID, name, num2 from tab
6
7 union all
8
9 select ID, name, num3 from tab
select
ID, name, decode(rn,
1
, num1,
2
, num2,
3
, num3)
from tab, ( select level rn from dual connect by 1 = 1 and level <= 3 )
from tab, ( select level rn from dual connect by 1 = 1 and level <= 3 )