What is the most efficient way to concatenate strings in SQL Server?
11
votes
2
answers
5103
views
I have this code:
DECLARE @MyTable AS TABLE
(
[Month] INT,
Salary INT
);
INSERT INTO @MyTable VALUES (1,2000), (1,3100);
SELECT [Month], Salary FROM @MyTable;
Output:
I want to concat the Salary (grouping by month) so that it will be

NVARCHAR
like this: '2000,3100'
How would I do this efficiently?
Asked by Misha Zaslavsky
(499 rep)
Mar 24, 2015, 06:48 AM
Last activity: Jun 21, 2021, 06:11 PM
Last activity: Jun 21, 2021, 06:11 PM