WMSYS.WM_CONCAT 函數的用法

我们通过 10g 所提供的 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.people,
       (select to_char(wmsys.wm_concat(real_name)) from user lu
    where instr(','||replace(t1.people,' ','')||',', ','||lu.uuid||',')>0 )  inside_people_name
from t1 
 

 

 

1 10168, 10085 a,b

2 10085, 10222, 10034 c,d,e

3 20330, 9999, 10004 f,g,h

4 10103 i

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值