I have an Access table containing timecard records for jobs:
JobID HoursWorked Rate 101 1.25 101 0.75 OT 102 0.33 DT 101 0.50 103 2.00
I want a query that returns a single record for each JobID
that has summed the HoursWorked
field. If [Rate] = "OT"
then HoursWorked
should be multiplied by 1.5, or in the case of DT, multiplied by 2.
The result would look like this:
JobID TotalHoursWorked 101 2.875 102 0.66 103 2.00
I came up with this query which successfully SUMS the different types of Rate
:
SELECT JobID, Sum(HoursWorked) AS TotalHoursWorked
FROM Timecards
GROUP BY JobID, Rate;
But I'm stuck at how to multiply the different rates and return a single total by JobID.