Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Query that counts male and female.

Author  Topic 

npandis
Starting Member

6 Posts

Posted - 2002-01-02 : 14:05:18
Hi.
I have a customer table, where I select from a combo box field the sex (male or female). I would like to run a query that will give me a count of the male and female customers.

Database is in access 2000.

Thank you
npandis

izaltsman
A custom title

1139 Posts

Posted - 2002-01-02 : 14:24:39
You could do this:

select
SUM (iif(sex = "male", 1, 0)) as male,
SUM (iif(sex = "female", 1, 0)) as female
from mytable

Go to Top of Page

npandis
Starting Member

6 Posts

Posted - 2002-01-03 : 16:31:46
Thank you.

It worked on the first trial!!!

quote:

You could do this:

select
SUM (iif(sex = "male", 1, 0)) as male,
SUM (iif(sex = "female", 1, 0)) as female
from mytable





Go to Top of Page
   

- Advertisement -