例如:
比如说本来字段name
name
张三
李四
显示结果为:张三,李四
create table tb(name varchar(30)) insert into tb select ‘张三‘ union all select ‘李四‘ select distinct STUFF( (select ‘,‘+name from tb for xml path(‘‘) ),1,1,‘‘ ) as name from tb
参考:https://bbs.csdn.net/topics/390667656