MySQL joins and COUNT(*) from another table

前端 未结 4 1322
失恋的感觉
失恋的感觉 2020-12-23 19:42

I have two tables: groups and group_members.

The groups table contains all the information for each group, such as its ID, tit

4条回答
  •  渐次进展
    2020-12-23 20:07

    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.

提交回复
热议问题