又是个经典问题啊 10G select A字段,WMSYS.WM_CONCAT(B字段) B字段 from tab group by A字段
10以下的 select A字段,substr(max(sys_connect_by_path(B字段 ,' ')),2) B字段 from (select a.*,row_number()over(partition by A字段 order by B字段) rn from a ) group by A字段 start with rn=1 connect by rn-1=prior rn and A字段 =prior A字段
10G
select A字段,WMSYS.WM_CONCAT(B字段) B字段
from tab
group by A字段
select A字段,substr(max(sys_connect_by_path(B字段 ,' ')),2) B字段
from (select a.*,row_number()over(partition by A字段 order by B字段) rn from a )
group by A字段
start with rn=1
connect by rn-1=prior rn and A字段 =prior A字段
因为经常有人问,就收藏起来,回答时ctrl+C + CTRL+V