title: How to concatenate result column values to a single row?
body: <p>How to concatenate the result values into a single row?</p>
  
  <p>I created two tables like this.</p>
  
  <p>first table</p>
  
  <pre><code>clientid name
  1        test1
  2        test2
  3        test3
  </code></pre>
  
  <p>second table</p>
  
  <pre><code>id   clientid
  3    1
  3    2
  3    3
  </code></pre>
  
  <p>my requirement getting </p>
  
  <pre><code>result
  3  test1,test2,test3
  </code></pre>
  
  <p>My SP....</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[usp_test]-- 3
      @ID INT
  AS  
  BEGIN
      SELECT CO.id,AR.name FROM dbo.test1 AR
      LEFT OUTER JOIN dbo.test2 CO On AR.clientid=CO.clientid
      WHERE CO.id=@ID
  END
  </code></pre>
  
  <p>Then I am getting result as</p>
  
  <pre><code>id  name
  3   test1
  3   test2
  3   test3
  </code></pre>
  
  <p>Please modify my sp to get the below format output</p>
  
  <pre><code>id  name
  3   test1,test2,test3
  </code></pre>