I have designed a view in SQL Server 2008 that displays 2 columns of distinct data in this format:
Column1 Column2
A Text1
B Text2
B Text3
C Text4
D Text5
D Text6
D Text7
E Text8
What do I have to do to get the view to display only the distinct Column1 values with Column2 values concatenated like this:
Column1 Column2
A Text1
B Text2, Text3
C Text4
D Text5, Text6, Text7
E Text8
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:
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
Edit: The revised code from @techdo worked, many thanks.