用逗号隔开(开头末尾都没逗号)
SELECT colName1,LISTAGG(colName2, ',') FROM tableName GROUP BY colName1
用逗号隔开(末尾有逗号)
SELECT colName1,replace(replace(xml2clob(xmlagg(xmlelement(NAME a, colName2||','))),'<A>',''),'</A>',' ')
FROM tableName
GROUP BY colName1
两字段合并输出
SELECT colName1 || colName2 FROM tableName
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279921.html