Returning on blank values

JamesMF82

Registered User.
Local time
Today, 18:46
Joined
Oct 22, 2013
Messages
18
Hi,

Looking for a hopefully simple answer to this problem. I have a list of employees and sort criteria. for example

empID....Criteria
1234......T
1234......F
1234......T
1234......F
1235......F
1236......T
1236......F
1236......F
1236......F
1236......T
1236......T
1237......F

The output I am looking for is a count of the number of times T appears by an employee, BUT is there is no record it would return 0

E.G.
empID......Count
1234...........2
1235...........0
1236...........3
1237...........0

I can get it to return:
empID......Count
1234...........2
1236...........3

using Count and the criteria Where Criteria="T" but not returning zeros. Any help would be great.

Thanks
 
Hello JamesMF82, How about something like..
Code:
SELECT yourTableName.empID, Sum(yourTableName.Criteria = 'T', 1, 0) As CountOfCriteria
FROM yourTableName GROUP BY yourTableName.empID
ORDER BY yourTableName.empID;
 
Hi,

I will give this a go thanks!
 

Users who are viewing this thread

Back
Top Bottom