I have a table that has an autoID, ForeignKey, ShiftID,EmpID,StartTime,EndTime and HrsWrked as shown below:
I have an initial query to make the pivot query simpler as:
Then I have a pivot query as:
However the results are strange. I'm getting some duplicates as shown below:
I don't know how or why but the additions appear to be later inserts into the table.
If anyone has any ideas on how to fix this, I will be greatly indebted to he/she. If anyone wants a copy of the access file I'll email them.
Thanks,
Rewdee
I have an initial query to make the pivot query simpler as:
Code:
SELECT (Employees.FirstName+' '+Employees.LastName) AS FullName, tempBatch.ShiftDate, (Format(tempBatch.StartTime,"h:n AM/PM")+' to '+Format(tempBatch.EndTime,"h:n AM/PM")) AS WorkHrs, tempBatch.ShiftWeekID, tempBatch.TimeWrked, Employees.EmployeeID
FROM tempBatch INNER JOIN Employees ON tempBatch.EmpID=Employees.EmployeeID
ORDER BY Employees.EmployeeID, tempBatch.ShiftDate;
Code:
PARAMETERS [paramShiftID] Long;
TRANSFORM First(qryTempWrkSchedule.WorkHrs) AS WorkHrs
SELECT qryTempWrkSchedule.FullName, sum(TimeWrked) AS TotalHours
FROM qryTempWrkSchedule
WHERE ShiftWeekID=[paramShiftID]
GROUP BY qryTempWrkSchedule.FullName, TimeWrked
ORDER BY FullName
PIVOT Format([ShiftDate],"Short Date");
I don't know how or why but the additions appear to be later inserts into the table.
If anyone has any ideas on how to fix this, I will be greatly indebted to he/she. If anyone wants a copy of the access file I'll email them.
Thanks,
Rewdee