SQL将多个字段查询出来拼接成一行

来源:互联网 发布:经典小说推荐 知乎 编辑:程序博客网 时间:2024/06/08 07:40
select stuff((select ','+fieldName  + ' as '  + alias from Table where a.No=No for xml path('')),1,1,'') as sqlJoint from 
Table as a where No='00001'
group by No

0 0
原创粉丝点击