MySQL Multiple Left加入可能的空记录

So I'm getting into JOINs in MySQL for the first time, and I've got the following setup:

table: user fields: id, name, ...other fields...

and several "group" tables, each with their own unique data, like so

table: user_group_1 fields: user_id, ...group_1 unique fields...

table: user_group_2 fields: user_id, ...group_2 unique fields...

table: user_group_X fields: user_id, ...group_X unique fields...

I am trying to do a query similar to this:

SELECT user.name as name, [...etc...], CONCAT( group_a.data_a,',', group_b.data_b,',', group_c.data_c ) as user_groups FROM user LEFT JOIN user_group_1 as group_a ON group_a.user_id=user.id LEFT JOIN user_group_2 as group_b ON group_b.user_id=user.id LEFT JOIN user_group_3 as group_c ON group_c.user_id=user.id

It works in gathering all the data from my user table, but my user_groups is empty. Now, a user can fall into any number of these groups, so each user may or may not have a record in any or all of these tables. I'm assuming I'm just using the wrong Join for this. Any push in the right direction would be greatly appreciated.

EDIT: When I query for a user, I need a list of all the group_x.data_x fields in which that user is present. For example, if I query for user.id=1, and I know that user is in group 2, but not group 1 or 3, I want to see user_groups contain: group_b.data_b but instead my user_groups field is empty. I am including the extra commas intentionally (rather than using CONCAT_WS) because I need a way to know from which user_group_x field the user_groups data came from.

Simpler approach is to use CONCAT_WS for this. The first parameter is the separator, which will be interjected between each result. If one of the fields is NULL, then it will be skipped and no separator inserted.

SELECT user.name as name, [...etc...], 
        CONCAT_WS(',', group_a.data_a, group_b.data_b, group_c.data_c ) as user_groups
 FROM user
 LEFT JOIN user_group_1 as group_a ON group_a.user_id=user.id
 LEFT JOIN user_group_2 as group_b ON group_b.user_id=user.id
 LEFT JOIN user_group_3 as group_c ON group_c.user_id=user.id

see @Bilbo's answer here.

and documentation here.

SELECT user.name as name, [...etc...], 
        CONCAT( group_a.data_a,',',
                group_b.data_b,',',
                group_c.data_c ) as user_groups
 FROM user
 INNER JOIN user_group_1 as group_a ON group_a.user_id=user.id
 INNER JOIN user_group_2 as group_b ON group_b.user_id=user.id
 INNER JOIN user_group_3 as group_c ON group_c.user_id=user.id

If i understand what you're looking for, your query is almost correct. You just missed to check if the group fields are NULL (to avoid an empty [user_groups] column). Here is the fixed query:

SELECT user.name as name, [...etc...],
        CONCAT_WS(','
                ,group_a.data_a
                ,group_b.data_b
                ,group_c.data_c) as user_groups
 FROM user
 LEFT JOIN user_group_1 as group_a ON group_a.user_id=user.id
 LEFT JOIN user_group_2 as group_b ON group_b.user_id=user.id
 LEFT JOIN user_group_3 as group_c ON group_c.user_id=user.id

Hope this will help you.