Group by date range

D

diarmuidq

Hi
In a query, is it possible to group by date range? I wish to count the
number of people born in each year, broken down by sex. I'd like a resultset
as follows

1972 M 50
1972 F 51
1973 M 61
1973 F 59

I know how to do it in a report, so if thats the only way, thats fine.
Thanks
Diarmuid
 
J

John Vinson

Hi
In a query, is it possible to group by date range? I wish to count the
number of people born in each year, broken down by sex. I'd like a resultset
as follows

1972 M 50
1972 F 51
1973 M 61
1973 F 59

Broken down by sex? I find that I'm more bouyed up than broken down by
it, but...

Create a Query based on your table. I presume that you have a Date of
Birth field; assuming it's named DOB put

BirthYear: Year([DOB])

in a vacant Field cell. Select the Sex field as well, and the primary
key field of the table.

Change the query to a Totals query by clicking the Greek Sigma icon
(looks like a sideways M). Leave the default Group By on the BirthYear
and Sex fields, and change it to Count on the primary key field.
 

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