Check out example codes for "coalesce for comma separated in sql server". It will help you in understanding the concepts better.

Code Example 1

DECLARE @List VARCHAR(8000)

SELECT @List = COALESCE(@List + ',', '') + CAST(OfferID AS VARCHAR)
FROM   Emp
WHERE  EmpID = 23

SELECT @List

Learn ReactJs, React Native from akashmittal.com