码迷,mamicode.com
首页 > 其他好文 > 详细

Grouping by Multiple Columns to Single Column as A String

时间:2014-08-21 21:00:04      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:for   sp   c   rom   ip   as   XML   select   

 

SELECT t.PROB_ID, STUFF(
(SELECT ‘,‘ + s.NOTES
FROM gpcomp1.GPPROBNOTES s
WHERE s.PROB_ID = t.PROB_ID
FOR XML PATH(‘‘)),1,1,‘‘) AS NOTES
FROM gpcomp1.GPPROBNOTES AS t
GROUP BY t.PROB_ID

Grouping by Multiple Columns to Single Column as A String,布布扣,bubuko.com

Grouping by Multiple Columns to Single Column as A String

标签:for   sp   c   rom   ip   as   XML   select   

原文地址:http://www.cnblogs.com/hellotech/p/3927954.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!