First I select all users and groups that they follow from the User table. Next, you need to get the number of people to each group, these data need to be pulled from the Groups table (link across the group field), now it would be nice to tighten the balance of the user of each balance here id is the uid in User.
The query works:
SELECT t1.uid, t1.group, t2.people FROM User AS t1, Groups AS t2 WHERE t1.group = t2.group But in the Groups table there are several entries and you need to choose where people is the maximum value. Change the request t2.people to t2.MAX (people) and everything stops working. Or at least how can I put LIMIT out of Groups, only 1 record is selected?
