M
Mandy J.S.
Currently we have 2 tables that are being used for attendance data. The
first contains only those that have attendance issues: late, leave early,
absent and the other one that has everyone and how many days they worked for
that week. We were having a requirement of 90 days of 0 points. Now it is
90 days of 9 points AND work 15 days in a month.
Here's the current query for the old attendance:
SELECT tblEmployees.numIDNumber, tblEmployees.strLastName,
tblEmployees.strMiddleName, tblEmployees.strFirstName,
Max(tblAttendance.dtmDate) AS MaxOfdtmDate, tblEmployees.ynCurrentEmp,
tblEmployees.ynSalariedEmp, tblEmployees.dtmAnniveraryCompany
FROM tblIncidentType RIGHT JOIN (tblEmployees LEFT JOIN tblAttendance ON
tblEmployees.numIDNumber = tblAttendance.numID) ON
tblIncidentType.strIncidentType = tblAttendance.strIncidentType
GROUP BY tblEmployees.numIDNumber, tblEmployees.strLastName,
tblEmployees.strMiddleName, tblEmployees.strFirstName,
tblEmployees.ynCurrentEmp, tblEmployees.ynSalariedEmp,
tblEmployees.dtmAnniveraryCompany
HAVING (((Max(tblAttendance.dtmDate))<=DateAdd("d",-90,CDate([Enter the
ending date:]))) AND ((tblEmployees.ynCurrentEmp)=Yes) AND
((tblEmployees.ynSalariedEmp)=No) AND
((tblEmployees.dtmAnniveraryCompany)<=DateAdd("d",-120,CDate([Enter the
ending date:]))))
ORDER BY tblEmployees.numIDNumber, Max(tblAttendance.dtmDate) DESC;
This works great.
The new attendance table contains the following fields:
employeeID
Week Starting
Days Worked
Month
So, for each employee ID for 90 days I want to add up the days worked and
make sure they have 0 points. This is how we are calculating who gets an
attendance bonus. The problem with the 0 points is if someone takes all of
their vacation time in one month, thus getting 0 points, but also not being
at work either. We had a guy take all 3 weeks of his vacation in January.
So, he got an attendance bonus for being able to show up for 5 days in a row
to work. That wasn't exactly fair to the rest of the people that were here
that whole time.
I hope all this makes sense. I am figuring that the new query will have
them joined on the employee ID.
Thanks for the assistance.
first contains only those that have attendance issues: late, leave early,
absent and the other one that has everyone and how many days they worked for
that week. We were having a requirement of 90 days of 0 points. Now it is
90 days of 9 points AND work 15 days in a month.
Here's the current query for the old attendance:
SELECT tblEmployees.numIDNumber, tblEmployees.strLastName,
tblEmployees.strMiddleName, tblEmployees.strFirstName,
Max(tblAttendance.dtmDate) AS MaxOfdtmDate, tblEmployees.ynCurrentEmp,
tblEmployees.ynSalariedEmp, tblEmployees.dtmAnniveraryCompany
FROM tblIncidentType RIGHT JOIN (tblEmployees LEFT JOIN tblAttendance ON
tblEmployees.numIDNumber = tblAttendance.numID) ON
tblIncidentType.strIncidentType = tblAttendance.strIncidentType
GROUP BY tblEmployees.numIDNumber, tblEmployees.strLastName,
tblEmployees.strMiddleName, tblEmployees.strFirstName,
tblEmployees.ynCurrentEmp, tblEmployees.ynSalariedEmp,
tblEmployees.dtmAnniveraryCompany
HAVING (((Max(tblAttendance.dtmDate))<=DateAdd("d",-90,CDate([Enter the
ending date:]))) AND ((tblEmployees.ynCurrentEmp)=Yes) AND
((tblEmployees.ynSalariedEmp)=No) AND
((tblEmployees.dtmAnniveraryCompany)<=DateAdd("d",-120,CDate([Enter the
ending date:]))))
ORDER BY tblEmployees.numIDNumber, Max(tblAttendance.dtmDate) DESC;
This works great.
The new attendance table contains the following fields:
employeeID
Week Starting
Days Worked
Month
So, for each employee ID for 90 days I want to add up the days worked and
make sure they have 0 points. This is how we are calculating who gets an
attendance bonus. The problem with the 0 points is if someone takes all of
their vacation time in one month, thus getting 0 points, but also not being
at work either. We had a guy take all 3 weeks of his vacation in January.
So, he got an attendance bonus for being able to show up for 5 days in a row
to work. That wasn't exactly fair to the rest of the people that were here
that whole time.
I hope all this makes sense. I am figuring that the new query will have
them joined on the employee ID.
Thanks for the assistance.