Your groups_main
table has a key column named id
. I believe you can only use the USING
syntax for the join if the groups_fans
table has a key column with the same name, which it probably does not. So instead, try this:
LEFT JOIN groups_fans AS m ON m.group_id = g.id
Or replace group_id
with whatever the appropriate column name is in the groups_fans
table.