Check out example codes for "sql server: select column values as comma separated string". It will help you in understanding the concepts better.

Code Example 1

DECLARE @SQL AS VARCHAR(8000)
SELECT @SQL = ISNULL(@SQL+',','') + ColumnName FROM TableName
SELECT @SQL

Learn ReactJs, React Native from akashmittal.com