I currently have the following SQl statement:
Returns:
empnum weeknumber date SumOfhours TotWk
025217 02 1/7/2008 800 4940
025217 02 1/8/2008 1160 4940
025217 02 1/9/2008 890 4940
025217 02 1/10/2008 1160 4940
025217 02 1/11/2008 930 4940
What I would also like is to break the amount of hours into Reg & OT based on 40 hrs:
empnum weeknumber date SumOfhours TotWk Reg OT
025217 02 1/7/2008 800 4940 800 0
025217 02 1/8/2008 1160 4940 1160 0
025217 02 1/9/2008 890 4940 890 0
025217 02 1/10/2008 1160 4940 1150 10
025217 02 1/11/2008 930 4940 0 930
Is this possible using a query?
Code:
SELECT A.empnum, A.weeknumber, A.date, A.SumOfhours, (Select Sum(sumofHours) From Table1 B Where B.[empnum]=A.[empnum] and b.[weeknumber]=a.[weeknumber]) AS TotWk
FROM Table1 AS A ORDER BY A.empnum, A.date;
empnum weeknumber date SumOfhours TotWk
025217 02 1/7/2008 800 4940
025217 02 1/8/2008 1160 4940
025217 02 1/9/2008 890 4940
025217 02 1/10/2008 1160 4940
025217 02 1/11/2008 930 4940
What I would also like is to break the amount of hours into Reg & OT based on 40 hrs:
empnum weeknumber date SumOfhours TotWk Reg OT
025217 02 1/7/2008 800 4940 800 0
025217 02 1/8/2008 1160 4940 1160 0
025217 02 1/9/2008 890 4940 890 0
025217 02 1/10/2008 1160 4940 1150 10
025217 02 1/11/2008 930 4940 0 930
Is this possible using a query?