G
Guest
First Off - I'm not very advanced when it comes to access. But I have two
tables: tbl_employees & tbl_violations. I want to find out how many times
an employee has a violation so I created this query using the group by (their
name) and count function (violation). It works correctly but I want the
query to return a zero next to the employees name if they don't have a
corresponding violation in the violations table. Please help!
SELECT Tbl_Employees.EmpFirstName & " " & [EmpLastName] AS fullname,
Count(Tbl_Violations.ViolationID) AS [Absense Count]
FROM Tbl_Employees INNER JOIN Tbl_Violations ON Tbl_Employees.EmployeeID =
Tbl_Violations.EmployeeID
WHERE (((Tbl_Violations.TypeID)=1) AND
((Tbl_Violations.DateofOccurance)>Date()-31))
GROUP BY Tbl_Employees.EmpFirstName & " " & [EmpLastName]
ORDER BY Count(Tbl_Violations.ViolationID) DESC;
tables: tbl_employees & tbl_violations. I want to find out how many times
an employee has a violation so I created this query using the group by (their
name) and count function (violation). It works correctly but I want the
query to return a zero next to the employees name if they don't have a
corresponding violation in the violations table. Please help!
SELECT Tbl_Employees.EmpFirstName & " " & [EmpLastName] AS fullname,
Count(Tbl_Violations.ViolationID) AS [Absense Count]
FROM Tbl_Employees INNER JOIN Tbl_Violations ON Tbl_Employees.EmployeeID =
Tbl_Violations.EmployeeID
WHERE (((Tbl_Violations.TypeID)=1) AND
((Tbl_Violations.DateofOccurance)>Date()-31))
GROUP BY Tbl_Employees.EmpFirstName & " " & [EmpLastName]
ORDER BY Count(Tbl_Violations.ViolationID) DESC;