I have a table called TimeSheet that has EmpID, Date, ShiftID,HoursWorked as fields.
I would like to Sum the HoursWorked for each employee between 2 dates say June 20th to June 26th like:
[COLOR=red yellow]Now here's the tricky part:[/color] In the sum I need to exclude the values if the ShiftID on the last date (June 26th) is 3 and include the values towards the sum if on the day before the start date (June 19) the ShiftID = 3.
If anyone can write this query, I will definitely add a star and heap much praise.
Thanks,
Rewdee
I would like to Sum the HoursWorked for each employee between 2 dates say June 20th to June 26th like:
Code:
SELECT TimeSheet.EmployeeID, Sum(TimeSheet.HrsWorked) AS SumOfHrsWorked, Count(EmployeeID) AS ShiftNum
FROM Timesheet
WHERE TimeSheet.ShiftDate >= #June 20, 2005# AND
TimeSheet.ShiftDate <= #June 26, 2005#
GROUP BY TimeSheet.EmployeeID
If anyone can write this query, I will definitely add a star and heap much praise.
Thanks,
Rewdee