摘要:
create table tb ([id] int,[name] varchar(2))insert into tbselect 1,'aa' union allselect 2,'bb' union allselect 1,'cc' union allselect 3,'dd' union allselect 2,'ee'select * from tb--查询select id, name=stuff((select ','+name from tb where id=t.id for xml path('')),1,1,'')from tb tgroup by id方法二:CREATE 阅读全文