SQL Server For XML 字段内容拼接
declare @tb table(F1 nvarchar(50),Gp nvarchar(50))
insert into @tb(F1,Gp)select 'a','A' union select 'a1','A' union select 'b','B' union select 'c1','c' union select 'c2','c'
select GP,(select distinct F1+' ' from @tb b where b.Gp=a.Gp for XML path(''))FED from @tb a
group by GP