String concatenation in SQL Server

I am trying to concatenate rows in SQL Server.

Suppose I have a table like:

C1 | C2 | C3 1 | A | 1 | | 1 | | B 2 | A | 2 | | C 

And I want to end up:

  C1 | C2 | C3 1 | A | B 2 | A | C 

Anyway, can I do this with a single request?

I am currently processing data manually using C #, but it is slow and I cannot limit the number of easily returned rows.

Thanks in advance!

+4
source share
1 answer

For example data

 SELECT C1, MAX(C2) AS C2, MAX(C3) AS C3 FROM YourTable GROUP BY C1 

SQL Fiddle

+11
source

Source: https://habr.com/ru/post/1491191/


All Articles