create Table T(地区varchar(10),负责人 varchar(10))insert into T values('A','甲')insert into T values('B','甲')insert into T values('C','甲')insert into T values('D','乙')insert into T values('E','乙')insert into T values('F','乙')insert into T values('G','丙')insert into T values('H','丙')insert into T values('I','丙')Select 负责人,Stuff((Select ','+地区 From T
Where 负责人=A.负责人
For xml Path('')),1,1,'') As 地区 From T AGroup by 负责人
|