Getting column values as comma seperated list using XML PATH()



select tc.customerid,stuff((
select ',' + convert(nvarchar(30),tct.Customer_TripId)
from tollplus.TP_Customers tc
inner join tollplus.TP_Customer_Trips tct
on tc.customerid=tct.customerid and tc.customerid=60000252
for xml path('')),1,1,'')as usergroups
from tollplus.TP_Customers tc where tc.customerid=60000252