Counting within a field

I

Isidore

My database contains 3 tables:
1) Stories (Key field: StoryID)
2) Characters (related to Stories by StoryID)
3) Genders (used to populate the field "Gender" in characters.

The possible choices in Genders are Male, Female, Either

I'd like to create a query that provides the following information:
A list of charcters
How many males
How many females
How many either
Total number of characters.

As I am a novice, I don't know how to do this. Any help would be
greatly appreciated.

Thanks in advance,
Isidore
 
M

[MVP] S.Clark

Using the GROUP BY operator, you can aggregate values. For example, to
count the number of orders per customer:

SELECT CustomerID, Count(OrderID) from tblOrders GROUP BY CustomerID

From the Query Design screen, you can choose View / Totals from the main
menu to assist you with writing this SQL code.
 
I

Isidore

Thanks for this. I see how this puts the information into table
rows, but I really need it to be in columns so that I can get the
information onto a form or report
(i.e.,
Number of Females:__
Number of Males:__
Number of Either:__
Total Characters:__ )
 
M

Mike Painter

Isidore said:
Thanks for this. I see how this puts the information into table
rows, but I really need it to be in columns so that I can get the
information onto a form or report
(i.e.,
Number of Females:__
Number of Males:__
Number of Either:__
Total Characters:__ )
If these are number fields the report designer will automaticaly let you
total things.
It's then just a matter of changing the labels and, if you wish, hide the
detail section.

Northwind has some reports that show this and it's easier to look at them
them try to get a description.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top