表名 test
其中test_a1,test_a2,test_a3字段名
test_a1 test_a12 test_a3
ss dd ff
sss ddd fff
s b v
s g h
s y
用一条sql使结果显示为
test_a1 test_a12 test_a3
ss dd ff
sss ddd fff
s b,g,t v,h,y
求一条sql语句?????
其中test_a1,test_a2,test_a3字段名
test_a1 test_a12 test_a3
ss dd ff
sss ddd fff
s b v
s g h
s y
用一条sql使结果显示为
test_a1 test_a12 test_a3
ss dd ff
sss ddd fff
s b,g,t v,h,y
求一条sql语句?????
http://blog.csdn.net/kinglht
- ---
1 aa
1 bb
1 cc
2 xx
2 yy
3 zz
3 mm select max(substr((sys_connect_by_path(name,',')),2)) cola
from (
select id,name,
rownum rnum,
row_number() over(partition by id order by id) rn1
from a
)
start with rn1=1
connect by rnum-1=prior rnum
group by id
;--------------------------------------------------------------------------------aa,bb,cc
xx,yy
zz,mm