junfkt2
5/21/2015 - 8:53 AM

group by,其他用逗号合并

group by,其他用逗号合并

select id,
name=stuff((select ','+name from #test where id=t.id for xml path('')),1,1,'')
from #test t
group by id