[quote]
如题,比如表(table_a)内容:
id name
1 zs
2 ls
3 as
能够通过一条sql语句,输出 'zs,ls,as'
11g里面用listagg,10g里面用wm_concat
select listagg(name,',') within (order by id) from table;
select wm_concat(name) from table;
select to_char(wm_concat(name)) names from table_a ;
其他的例子:code可以对应多个name
select code, to_char(wm_concat(name) ) up_key
from match_code
WHERE code = '409001'
group by code;
[/quote]
如题,比如表(table_a)内容:
id name
1 zs
2 ls
3 as
能够通过一条sql语句,输出 'zs,ls,as'
11g里面用listagg,10g里面用wm_concat
select listagg(name,',') within (order by id) from table;
select wm_concat(name) from table;
select to_char(wm_concat(name)) names from table_a ;
其他的例子:code可以对应多个name
select code, to_char(wm_concat(name) ) up_key
from match_code
WHERE code = '409001'
group by code;
[/quote]