22,209
社区成员
发帖
与我相关
我的任务
分享
insert into tb
select Ltyp,stuff((select ','+Lname from #SQltemp b where a.Ltyp=b.Ltyp order by Lname for xml path('')),1,1,'')
from #SQltemp a
group by Ltyp
--or
select Ltyp,stuff((select ','+Lname from #SQltemp b where a.Ltyp=b.Ltyp order by Lname for xml path('')),1,1,'')
into tb
from #SQltemp a
group by Ltyp
insert into 另表
select Ltyp,
stuff((select ','+Lname from #SQltemp b where a.Ltyp=b.Ltyp order by Lname for xml path('')),1,1,'') from #SQltemp a group by Ltyp