woodrow
03-26-2002, 12:45 PM
I'm trying to count the number of times a value appears in a table, where it's ID matches another tables ID.
The following is the relevant information from each table:
tblInfo contains ClientID, Gender
tblDetail contains ClientID
I want to count the number of times that the gender "Male" occurs in tblInfo where tblDetail.ClientID = tblInfo.ClientID
I've tried
SELECT DCount("[Gender]","tblInfo","gender = 'male' ") AS M,
DCount("[Gender]","tblInfo","gender = 'female' ") AS F
FROM tblInfo, tblDetail
where tblInfo.ClientID = tblDetail.ClientID;
But this returns a count of ALL the records for 'Male' and 'Female' in tblInfo, instead of only those where ClientID matches.
Could someone tell me what I'm doing wrong?
[This message has been edited by woodrow (edited 03-26-2002).]
The following is the relevant information from each table:
tblInfo contains ClientID, Gender
tblDetail contains ClientID
I want to count the number of times that the gender "Male" occurs in tblInfo where tblDetail.ClientID = tblInfo.ClientID
I've tried
SELECT DCount("[Gender]","tblInfo","gender = 'male' ") AS M,
DCount("[Gender]","tblInfo","gender = 'female' ") AS F
FROM tblInfo, tblDetail
where tblInfo.ClientID = tblDetail.ClientID;
But this returns a count of ALL the records for 'Male' and 'Female' in tblInfo, instead of only those where ClientID matches.
Could someone tell me what I'm doing wrong?
[This message has been edited by woodrow (edited 03-26-2002).]