Q:

COALESCE() function with join

I have three tables, 

comments: id, user_id, place_id, text
places: id, name
users: id, name

I'd like to show a list of all the places with a list of all the users who commented on that place.
McDonalds  Jill, Suzy, Bob
Walmart    Fred, Joe, Suzy, Larry
Library    Joe, Suzy
...

I am trying to use the coalesce function to achieve this but I am running into trouble. What am I doing wrong?
SELECT places.name, COALESCE(users.name+",")
FROM comments
JOIN places
ON comments.place_id = places.id
WHERE user_id = users.id
GROUP BY places.name

Thanks.

A:

Try this !
Using Coalesce is not relevant here,try using STUFF with XML PATH('')
SELECT t1.name, 
STUFF(
(
SELECT ',' + [places.name] FROM comments
JOIN places
ON comments.place_id = places.id
WHERE user_id = users.id
GROUP BY places.name
for xml path('')
),1,1,'') as t1 from table <group by>

