您可以使用XML Path来连接列值
;With Cte(city,concat) as( select city, (select a.Zoo+',' from Sample a where a.city=b.city for XML PATH ('') ) concat from Sample b group by city )Select city,left(concat, len(concat) -1) from cte在SQL
Fiddle中检查结果



