日期:2014-05-17  浏览次数:20737 次

sql查询语句高手进
a                   b
200604862   10
200604862   20
200604862   30
------------------------
查询后结果如下:

200604862         10,20,30

请问该如何写呢?

------解决方案--------------------
Select x,max(substr((sys_connect_by_path(y, ', ')),2)) cola
from ( select x,y, rownum rnum,
row_number() over(partition by x order by x) rn1
from a )
start with rn1=1
connect by rnum-1=prior rnum
group by x