列转行,oracle列转行
test:
c1 c2
1 a
1 b
2 c
select
to_char(wmsys.wm_concat(c2)) ,
to_char(replace(wmsys.wm_concat(c2),',','/'))
from
test
group by
c1
show case:
1 a,b a/b
2 c c
同样的功能函数:
select listagg(c2,',') within group(order by c1) from test ;
假设原来的数据在A列 按照你的意思是否在B至I列输出你所需要的结果 如下
A B C D E F G H I
1A A B C D E F G H
2BA1B1C1D1E1F1G1H1
3C................
4D................
5E................
..
我的方法是:在B1列输入一个函数公式=INDEX($A:$A,COLUMN()-1+(ROW()-1)*8,1)
向右填充到I列 再向下填充即可
本人也是EXCEL初学者 这个方法也只能对你这个问题可能有效
同时A列中数据要连续不能有空格
不知道是否对你有所帮助。
select 'A',A from table union all
select 'B', B from table union all
select 'C', C from table union all
select 'D',D from table union all
select 'E',E from table
遇到行列转换的问题第一反应就是 uinon all