📅  最后修改于: 2022-03-11 15:05:08.984000             🧑  作者: Mango
SELECT ID, abc = STUFF(
(SELECT ',' + name
FROM temp1 t1
WHERE t1.id = t2.id
FOR XML PATH (''))
, 1, 1, '') from temp1 t2
group by id;