SQL SERVER 同一字段,整合同类项

 

 

 

select * from dbo.test with(nolock)

select
name,
stuff((select distinct ','+cast(code as varchar(30)) from dbo.test where name=t.name for xml path('')),1,1,'') as code
from dbo.test t
group by name

posted @ 2022-01-24 14:49  Lee597  阅读(121)  评论(0)    收藏  举报