Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Select Query That is Selecting the Wrong Data!!!!!

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top