原数据:
期望得到:
语法:
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
原数据:
期望得到:
语法:
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