What about something like:
Select cm.first_name || cm.last_name as name,
(select count(cm2.club_id) from club_members cm2 where cm2.student _id = cm.student_id)
From club_members cm
Where cm.status = 'active'
Daniel Araujo
MIS/PEIMS Coordinator
Los Fresnos CISD
(956)233-6995
---------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: This email and any files transmitted with it are the property of the Los Fresnos Consolidated Independent School District, are confidential, and are intended solely for the use of the individual or entity to whom this email is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. If you are the named recipient you are not authorized to reveal any of this information to any other unauthorized person. Any other use, retention, dissemination, forwarding, printing, or copying of this email is strictly prohibited.
-----Original Message-----
From:
informix-l...@iiug.org [mailto:
informix-l...@iiug.org] On Behalf Of Spokey Wheeler Gmail
Sent: Wednesday, May 09, 2012 7:50 AM
To: Floyd Wellershaus
Cc:
inform...@iiug.org
Subject: Re: help with query please ?
Something like:
select first_name || last_name as wholename, count(*) as ccount from club_members group by 1 into temp tccount;
select count(wholename), ccount
from tccount
group by 2
order by 2;
Or you could do something like
select count(wholename), ccount
from (
select first_name || last_name as wholename, count(*) as ccount from club_members group by 1
)
group by 2
order by 2;
Not tested either one.
Not sure how you're going to cope with students who aren't in any clubs.
CONFIDENTIALITY NOTICE: This email & attached documents may contain confidential information. All information is intended only for the use of the named recipient. If you are not the named recipient, you are not authorized to read, disclose, copy, distribute or take any action in reliance on the information and any action other than immediate delivery to the named recipient is strictly prohibited. If you have received this email in error, do not read the information and please immediately notify sender by telephone to arrange for a return of the original documents. If you are the named recipient you are not authorized to reveal any of this information to any other unauthorized person. If you did not receive all pages listed or if pages are not legible, please immediately notify sender by phone.