oralce group by字符串拼接

WMSYS.WM_CONCAT()  拼接字符串以逗号分隔

SQL> select * from idtable;

        ID NAME
---------- ------------------------------
        10 ab
        10 bc
        10 cd
        20 hi
        20 ij
        20 mn

SQL> select id,wmsys.wm_concat(name) name from idtable
  2  group by id;

        ID NAME
---------- --------------------------------------------------------------------------------
        10 ab,bc,cd
        20 hi,ij,mn


select t1.projectid , WMSYS.WM_CONCAT(case when role = '0' then accountid end) over(order by projectid test1 ,WMSYS.WM_CONCAT(decode(t.role, '1', t.accountid)) test2 , WMSYS.WM_CONCAT(t.accountid) acc from PROJECTACCOUNT t, PROJECT t1 where t.projectid = t1.projectid group by t1.projectid 


参考:http://blog.csdn.net/yy_mm_dd/article/details/3182953


你可能感兴趣的:(oralce group by字符串拼接)