原数据:
期望得到:
语法:
SELECT ApplyId ,stuff(( SELECT ','+SplitCostNo FROM CET AS tb01 where tb01.ApplyId=tb02.ApplyId FOR xml PATH('')),1,1,'') AS classList FROM CET AS tb02 GROUP BY ApplyId
参考链接:https://www.cnblogs.com/fang-beny/p/3255171.html
PS:楼主邮箱 tccwpl@163.com