sql server的拆分和合并
原数据:
期望得到:
语法:
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
PS:转载请注明来源 https://www.cnblogs.com/sunshine-wy,疑问和勘误可在下方留言。