Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query totals - Split by Male & Female

Status
Not open for further replies.

DAmoss

Technical User
Jul 23, 2003
169
GB
I have the following Ethnicity query which generates all my count totals for each entry:

SELECT ETHN.Description AS Ethnicity, Count([Project Data].ETHN) AS Total
FROM ETHN LEFT JOIN [Project Data] ON ETHN.Value = [Project Data].ETHN
GROUP BY ETHN.Description;

I want to be able to get the query to also show how many Male & Females there are alongside each ethnicity total?

My gender field is called [GEND], an help will be much appreciated.

Cheers
 
No need to help I've solved it myself ...

SELECT ETHN.Description AS Ethnicity, Count([Project Data].ETHN) AS Total, Sum(IIf([GEND]="M",1,0)) AS Male, Sum(IIf([GEND]="F",1,0)) AS Female
FROM ETHN LEFT JOIN [Project Data] ON ETHN.Value = [Project Data].ETHN
GROUP BY ETHN.Description;

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top