Multiple rows in a single row with separator in SqlServer
Here is a simple way to make a single row value from multiple rows with a separator in SqlServer. I have a table like the following…
Table Name: People
Column name :ID,Name
Now I need the ‘Name’ column values where matching the value of ‘aaaa’ in to a single row. For this I have tried to make a query. Just use the following query to get the solution. declare @res varchar(1000) select @res = coalesce(@res + ',', '') +Name from people WHERE Name = 'aaaa' select @res