日期:2014-05-18 浏览次数:20491 次
if not object_id('tb') is null drop table tb Go Create table tb([A] int,[B] nvarchar(1)) Insert tb select 1,N'a' union all select 2,N'b' union all select 3,N'c' Go Select distinct stuff((select ','+[B] from tb for xml path('')),1,1,'') from tb t /* a,b,c */