Unanswered: Multiple rows combined based on a column
I have a table with two columns refid and name and it has the following values
I need a resultset that would have the following values
1 tom, jim, bob
I have tried couple of things one being:
DECLARE @namelist VARCHAR(1000)
SELECT @namelist = COALESCE(@namelist +', ' ,'') + name FROM sales where refid = 1
but i am looking for a resultset with a unique refid and all the names comma separated for that refid.