MySQL Forums
Forum List  »  Full-Text Search

GROUP CONCAT on 2 tables
Posted by: Paul Polin
Date: June 22, 2012 04:58AM

I need a group_concat on 2 tables, I can get it working with 1 but not with 2

SELECT r.user_id, GROUP_CONCAT(p.name) AS members
FROM table1 r INNER JOIN table2 p on p.user_id = r.user_id
GROUP BY p.user_id ;

I get for each row many times the same name

user_id ---- members

128 ---- Paul,Paul,Paul
248 ---- Piotr, Piotr

how can I get it ?

thank you



Edited 2 time(s). Last edit at 06/22/2012 05:16AM by Paul Polin.

Options: ReplyQuote


Subject
Views
Written By
Posted
GROUP CONCAT on 2 tables
4764
June 22, 2012 04:58AM
2075
July 01, 2012 06:34PM
2087
July 02, 2012 12:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.