select bf_wlbm,bf_wz from p_baofei where bf_type='1011' and bf_qty>0;
查询结果为:
1010 11-11
1011 11-12
写个函数,将bf_type作为参数,然后返回bf_wz字段符合条件的拼接字符串,
如:11-11,11-12
------解决思路----------------------
数据库什么版本?11g以上可以使用listagg
select listagg(bf_wz,';')within group(order by rownum) from p_baofei where bf_type='1011' and bf_qty>0
低版本只能连接完再使用replace替换
select replace(wmsys.wm_concat(bf_wz),',',';')
from p_baofei where bf_type='1011' and bf_qty>0