Posted by Domestos on 02/13/06 01:58
"Mick" <mickoc@gmail.com> wrote in message
news:1139788418.350629.281030@g14g2000cwa.googlegroups.com...
> Hi all,
>
> I am trying to construct a sql query which will retrieve the group name
> and
> number of people in each group from the below table structure
>
> sms_people
> - member_id
> - member_name
> - member_lastname
> - member_number
> - member_region
>
> sms_people_groups
> - group_id
> - member_id
>
> sms_groups
> - group_id
> - group_name
> - group_description
>
> All i have available to search on is the group_id. I'm having trouble
> retrieving the group_name and the number of members it contains as they
> are in separate tables..
>
> Any help much appreciated,
>
> Cheers,
> Michael
>
SELECT group_name FROM sms_groups WHERE group_id='xxx'
SELECT COUNT(member_id) FROM sms_people_groups WHERE group_id='xxx'
These are the SQL statments and some work will be required to pass it into
PHP.
[Back to original message]
|