Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database with one line being the sex of the person. I want to count
how many people of each sex were input. Also I want to count by age groups
hwo many in each age group. TY
 
I have a database with one line being the sex of the person. I want to count
how many people of each sex were input.

Create a Query based on the table. Select the Primary Key (some field
that is never NULL, the PK will always work) and the Sex field.

Make it a Totals query by clicking the Greek Sigma icon (looks like a
sideways M); leave the default Group By on the Sex field and change it
to Count on the other field.

Open the query; you'll see two lines with counts.
Also I want to count by age groups
hwo many in each age group. TY

Now you'll have to explain what you mean by "age group" and how you
can determine who's in which group. Do you have birthdates stored
(good!) or ages (oops... they'll ALL be wrong twelve months from
now...)

John W. Vinson[MVP]
 
The age would be the age at the time they took the class from us.

Ok... what's an "age group" then? And what's the datatype of the Age
field?

John W. Vinson[MVP]
 
Would be like 10-16, 17-21 and such the ages would be entered as a single age
such as 18, 25 and so on. The data field type is number
 
Would be like 10-16, 17-21 and such the ages would be entered as a single age
such as 18, 25 and so on. The data field type is number

One way is to use an auxiliary table, Ranges, with fields Low, High,
and Range: e.g.

10; 16; "10 to 16"
17; 21; "17 to 21"

etc.

Create a Query with your table and this table, with NO join line;
instead put a criterion on Age of
= [Low] AND <= [High]

and include Range in your query. Make it a totals query and Group By
Range.

John W. Vinson[MVP]
 
TYVM

John W. Vinson said:
Would be like 10-16, 17-21 and such the ages would be entered as a single age
such as 18, 25 and so on. The data field type is number

One way is to use an auxiliary table, Ranges, with fields Low, High,
and Range: e.g.

10; 16; "10 to 16"
17; 21; "17 to 21"

etc.

Create a Query with your table and this table, with NO join line;
instead put a criterion on Age of
= [Low] AND <= [High]

and include Range in your query. Make it a totals query and Group By
Range.

John W. Vinson[MVP]
 
so if I have 2 - 16 yo and 4-21 yo adn 1 35 yo and 5 55 yo people take this
class how would write the query to give me the totals of people when we input
ages as the actual age of the person?

Help said:
TYVM

John W. Vinson said:
Would be like 10-16, 17-21 and such the ages would be entered as a single age
such as 18, 25 and so on. The data field type is number

One way is to use an auxiliary table, Ranges, with fields Low, High,
and Range: e.g.

10; 16; "10 to 16"
17; 21; "17 to 21"

etc.

Create a Query with your table and this table, with NO join line;
instead put a criterion on Age of
= [Low] AND <= [High]

and include Range in your query. Make it a totals query and Group By
Range.

John W. Vinson[MVP]
 
so if I have 2 - 16 yo and 4-21 yo adn 1 35 yo and 5 55 yo people take this
class how would write the query to give me the totals of people when we input
ages as the actual age of the person?

I don't know, because I don't know the structure and fieldnames of
your table, nor do I understand your question. "the totals of
people"???

John W. Vinson [MVP]
 
anyway I can send you the file

John W. Vinson said:
I don't know, because I don't know the structure and fieldnames of
your table, nor do I understand your question. "the totals of
people"???

John W. Vinson [MVP]
 
I figured it out last night THANK YOU

John W. Vinson said:
That depends. Can I send you a consulting invoice? I'd be glad to send
you my terms.

John W. Vinson [MVP]
 
Back
Top