Check out example codes for "rows to comma separated values in mssql". It will help you in understanding the concepts better.

Code Example 1

DECLARE @test NVARCHAR(max)  
SELECT @test = COALESCE(@test + ',', '') + field2 FROM #test
SELECT field2 = @test

Learn ReactJs, React Native from akashmittal.com