select result=stuff((SELECT ','+cast([字段名] as varchar) FROM [表名] WHERE [条件] FOR XML PATH('')),1,1,'')