Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query to Count Number of Students 1

Status
Not open for further replies.

Caron

Technical User
Jul 9, 2001
3
US
In my student database, I need to produce a query that will provide a count of the number of students in each classroom so that I can list the results on a report.

I would like the report to look something like this:

Appling Black Carter Davidson
4 5 17 8

Any help greatly appreciated.

P.S. Is there a way to break the results up by females and males? I have a field for sex in my student demographics table.
 
Hi :)

I think this query will work

Select Class_Section,Count(StudentId) As Count_Students from Mytable
Group by Class_Section;

It will show output like

Class_Section Count_Students
------------- ---------------
Green 45
Blue 54
Yellow 12


For the 2nd Problem:

Select Class_Section,Sex,Count(StudentId) As Count_Students from Mytable
Group by Class_Section,Sex;

This query will show something like:

Class_Section Sex Count_Students
------------- --- ---------------
Green Male 25
Green Female 20
Blue Male 34
Blue Female 20

etc...etc.

I hope this will help ur cause.

Cheers!
Aqif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top