SQL, How to Concatenate results?

前端 未结 7 1951
渐次进展
渐次进展 2020-11-29 08:08

I currently have a SQL query that returns a number of fields. I need one f the fields to be effectively a sub query sub that.

The Problem in detail:

7条回答
  •  情书的邮戳
    2020-11-29 08:32

    Small update on Marc we will have additional " , " at the end. i used stuff function to remove extra semicolon .

           SELECT STUFF((  SELECT ',' + ModuleValue AS ModuleValue
                               FROM ModuleValue WHERE ModuleID=@ModuleID
                          FOR XML PATH('') 
                         ), 1, 1, '' )
    

提交回复
热议问题