db2笔记_4_字段值合并输出
作者:互联网
用逗号隔开(开头末尾都没逗号)
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
标签:段值,colName2,tableName,笔记,replace,逗号,colName1,db2,SELECT 来源: https://www.cnblogs.com/luyuting/p/16575913.html