select atype,name_list from (
select listagg(aname,',') within group( order by atype) name_list ,atype from listtable where age>0
group by atype) a
;
/*
查询 listtable表 里面 所有age大于0的 name,
按照 atype 输出,
name之间用,拼接起来成为字符串,该字段名为name_list
*/
标签:name,atype,每组,list,查询,逗号,拼接,sql,字符串 From: https://www.cnblogs.com/shilo930/p/17382120.html