I have a select query in Access 2000, which is selecting the wrong person of the sample database. It should be selecting the second employee, who is set for perfect attendence, but it is not, it is selectin the first for some reason. Here is my query:
SELECT Att.EmployeeNumber,
Emp.NameFirst,
Emp.NameInitial,
Emp.NameLast,
COUNT(Att.EmployeeNumber) AS RecCnt
FROM tblEmployees AS Emp LEFT JOIN tblAttendence AS Att
ON Emp.EmployeeNumber=Att.EmployeeNumber
WHERE (Emp.EmpStatusType="Active"
And Emp.PayType="per Hour"
And (Att.DateWeekStarting Between Nz([Enter Start Date], DateAdd("ww",-1-GetNumWeeks(), Date()))
And Dateadd("ww", GetNumWeeks(), Nz([Enter Start Date], DateAdd("ww",-1-GetNumWeeks(), Date()))))
And ((Att.WorkDay1Reason Is Null
Or Att.WorkDay1Reason="HolD-A"
And (Att.WorkDay2Reason Is Null
Or Att.WorkDay2Reason="HolD-A"
And (Att.WorkDay3Reason Is Null
Or Att.WorkDay3Reason="HolD-A"
And (Att.WorkDay4Reason Is Null
Or Att.WorkDay4Reason="HolD-A"
And (Att.WorkDay5Reason Is Null
Or Att.WorkDay5Reason="HolD-A")
GROUP BY Att.EmployeeNumber, Emp.NameFirst, Emp.NameInitial, Emp.NameLast
HAVING COUNT(Att.EmployeeNumber)=13
ORDER BY Att.EmployeeNumber;
Anyone have any ideas why it is runing like it is backwards? Thanks alot in advance.
SELECT Att.EmployeeNumber,
Emp.NameFirst,
Emp.NameInitial,
Emp.NameLast,
COUNT(Att.EmployeeNumber) AS RecCnt
FROM tblEmployees AS Emp LEFT JOIN tblAttendence AS Att
ON Emp.EmployeeNumber=Att.EmployeeNumber
WHERE (Emp.EmpStatusType="Active"
And Emp.PayType="per Hour"
And (Att.DateWeekStarting Between Nz([Enter Start Date], DateAdd("ww",-1-GetNumWeeks(), Date()))
And Dateadd("ww", GetNumWeeks(), Nz([Enter Start Date], DateAdd("ww",-1-GetNumWeeks(), Date()))))
And ((Att.WorkDay1Reason Is Null
Or Att.WorkDay1Reason="HolD-A"
And (Att.WorkDay2Reason Is Null
Or Att.WorkDay2Reason="HolD-A"
And (Att.WorkDay3Reason Is Null
Or Att.WorkDay3Reason="HolD-A"
And (Att.WorkDay4Reason Is Null
Or Att.WorkDay4Reason="HolD-A"
And (Att.WorkDay5Reason Is Null
Or Att.WorkDay5Reason="HolD-A")
GROUP BY Att.EmployeeNumber, Emp.NameFirst, Emp.NameInitial, Emp.NameLast
HAVING COUNT(Att.EmployeeNumber)=13
ORDER BY Att.EmployeeNumber;
Anyone have any ideas why it is runing like it is backwards? Thanks alot in advance.