Unable to count multiple fields in a single query

G

Guest

I have a table with employee data. I am trying to get summary data for each
job title.........for EACH title, I am trying to get the following counts:
number of all employees with the title, number of females with the title,
number of minorities with the title. Also, I want to group the data by
Business Unit (Division). I am able to get each count in a separate query,
but I am not able to get in one query a single record for each title that has
all the counts. For instance:

Job Title: Accountant Total EE's: 25 Females: 19 Minority:
10
Job Title: Developer Total EE's: 75 Females: 38 Minority:
26
Job Title: Tester Total EE's: 30 Females: 12
Minority: 11
Job Title: Manager Total EE's: 8 Females: 4
Minority: 2

Thanks!!!!!
 
G

Guest

Try this ---
SELECT YourTableName.[Job Title], Sum(IIf([Sex]="m",1,0)) AS Male,
Sum(IIf([Sex]="f",1,0)) AS Female, Sum(IIf([Miniority]=True,1,0)) AS
Miniorities
FROM YourTableName
GROUP BY YourTableName.[Job Title];
 
G

Guest

With your total ---
SELECT YourTableName.[Job Title], Count(YourTableName.[Job Title]) AS [Total
EE's], Sum(IIf([Sex]="m",1,0)) AS Male, Sum(IIf([Sex]="f",1,0)) AS Female,
Sum(IIf([Miniority]=True,1,0)) AS Miniorities
FROM YourTableName
GROUP BY YourTableName.[Job Title];
 

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