with temp as( 
select 'China' nation ,'Guangzhou' city from dual union all 
select 'China' nation ,'Shanghai' city from dual union all 
select 'China' nation ,'Beijing' city from dual union all 
select 'USA' nation ,'New York' city from dual union all 
select 'USA' nation ,'Bostom' city from dual union all 
select 'Japan' nation ,'Tokyo' city from dual 

select nation,listagg(city,',') within GROUP (order by city) 
from temp 
group by nation 

这是最基础的用法:
LISTAGG(XXX,XXX) WITHIN GROUP( ORDER BY XXX)

用法就像聚合函数一样,通过Group by语句,把每个Group的一个字段,拼接起来。

实战sql:

select listagg(t.SPURIOUS_DESC, ';') within GROUP(order by t.spurious_desc) SPURIOUS_DESC
from zc_tr_appraise t
where t.banknote_id = '1';

相关文章:

  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2021-09-09
  • 2022-12-23
  • 2021-09-07
猜你喜欢
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
相关资源
相似解决方案