I can get the number of employees that have taken the course in one query, but if I try to get the count that hasn't, I get no records returned. I know it's the join I'm using, but I'm not sure how to write it. Right now I've got:THis is driving me crazy. I just threw a pen at my monitor. I think my co-worker next to me is scared.
Here's my statement that joins and shows all. I know there's redundant stuff in it. I'm just trying to work through it:
*tblEmployeeScheduled got changed from above to tblIndividualLearning
Code:
SELECT tblEmployee.EmpID, tblIndividualLearning.EmpID, tblIndividualLearning.CatelogID
FROM tblEmployee LEFT JOIN tblIndividualLearning ON tblEmployee.[EmpID] = tblIndividualLearning.[EmpID]
WHERE (((tblIndividualLearning.CatelogID)=19));
If I add "Is Null" to tblIndividualLearning.EmpID, I get nothing:
Code:
SELECT tblEmployee.EmpID, tblIndividualLearning.EmpID, tblIndividualLearning.CatelogID
FROM tblEmployee LEFT JOIN tblIndividualLearning ON tblEmployee.[EmpID] = tblIndividualLearning.[EmpID]
WHERE (((tblIndividualLearning.EmpID) Is Null) AND ((tblIndividualLearning.CatelogID)=19));
This gets me a grouped my office list of employees that have not had course #19. If I try to total by EmpID though, it just totals ALL EMPLOYEES, not just the ones in this list.
Code:
SELECT tblOffices.District, tblOffices.OfficeName, tblEmployee.EmpID
FROM tblOffices INNER JOIN tblEmployee ON tblOffices.ID = tblEmployee.Office
GROUP BY tblOffices.District, tblOffices.OfficeName, tblEmployee.EmpID
HAVING (((tblOffices.District)=54) AND ((tblEmployee.EmpID) Not In (SELECT tblIndividualLearning.EmpID
FROM tblEmployee LEFT JOIN tblIndividualLearning ON tblEmployee.[EmpID] = tblIndividualLearning.[EmpID]
WHERE (((tblIndividualLearning.CatelogID)=19))
)));