如何在group_title = notitle的组中查找count成员 。我的db是mysql。
groups table -> id | group_number | notification_id | group_title | salavat_count | status
32 1kk NULL notitle 0 idle
33 2k NULL notitle 0 idle
groups_members table -> id | groups_id | members_id
1 32 222
我想要秀秀:
groups.id | memberCount
32 1
33 0
答案 0 :(得分:0)
SELECT COUNT(*)FROM groups_member groups.group_number = groups_member.id上的JOIN组其中groups.group_title =' notitle'
答案 1 :(得分:0)
我找到了。
SELECT COUNT(groups_members.id),groups.*
FROM groups_members
right JOIN groups
on groups.id = groups_members.`groups_id`
where groups.group_title = 'notitle'
group by groups.id;