title: sql concatenate multiple values
body: <p>I have designed a view in SQL Server 2008 that displays 2 columns of distinct data in this format:</p>
  
  <pre><code>Column1 Column2
  A       Text1
  B       Text2
  B       Text3
  C       Text4
  D       Text5
  D       Text6
  D       Text7
  E       Text8
  </code></pre>
  
  <p>What do I have to do to get the view to display only the distinct Column1 values with Column2 values concatenated like this:</p>
  
  <pre><code>Column1 Column2
  A       Text1
  B       Text2, Text3
  C       Text4
  D       Text5, Text6, Text7
  E       Text8
  </code></pre>
  
  <p>If I use the code suggested in the answers you seem to be considering as duplicate to this question, then I get this kind of result:</p>
  
  <pre><code>Column1 Column2
  A       Text1,Text2,Text3,Text4,Text5,Text6,Text7,Text8
  B       Text1,Text2,Text3,Text4,Text5,Text6,Text7,Text8
  C       Text1,Text2,Text3,Text4,Text5,Text6,Text7,Text8
  D       Text1,Text2,Text3,Text4,Text5,Text6,Text7,Text8
  E       Text1,Text2,Text3,Text4,Text5,Text6,Text7,Text8
  </code></pre>
  
  <p>Edit: The revised code from @techdo worked, many thanks.</p>