Greetings,
First time on the Forum. Here is my problem.
I have two SQL tables joined as shown below. For each employee, I return the hours worked for each day. My goal is to calculate the subtotal for the week and add the subtotal as a column (Total) for each row. See my example below. I am not sure how to write the SQL script.
Thank you.
Select a.EmpID, b.Day, b.Hrs from Employee a
Inner Join EmployeeHours b on
a.EmpID = b.EmpID
EmpID Day Hrs
12345 Mon 10.0
12345 Tue 0.0
12345 Wed 9.0
12345 Thur 8.0
12345 Fri 11.0
22222 Mon 10.5
22222 Tue 9.5
22222 Wed 9.0
22222 Thur 8.0
22222 Fri 11.0
Desired
EmpID Day Hrs Total
12345 Mon 10.0 38.0
12345 Tue 0.0 38.0
12345 Wed 9.0 38.0
12345 Thur 8.0 38.0
12345 Fri 11.0 38.0
22222 Mon 10.5 48.0
22222 Tue 9.5 48.0
22222 Wed 9.0 48.0
22222 Thur 8.0 48.0
22222 Fri 11.0 48.0