Hi,
I have a staff activity database i.e.; Over time, annual leave, sickness and I need to produce a monthly report. The information is recorded weekly with the weekending date entered as "dateID" and the staff grouped in locations. I have done a couple of queries to first group and them to sum the information. This is where I'm stuck, I am left with 4 weeks information for each location but I would like 4 weeks to show as 1 month.
Qryreport1 SQL:
SELECT tblRecords.LocationId, tblLocation.L_Location_Name, tblUnit.U_Unit_Name, tblRecords.DateId, tblmonths.fldmonths, tblRecords.HRS, tblRecords.OT, tblRecords.EX, tblRecords.LTS, tblRecords.STS, tblRecords.AL, tblRecords.ML, tblRecords.SL, tblRecords.CL, tblRecords.UL, tblRecords.OL
FROM tblmonths INNER JOIN (tblUnit INNER JOIN (tblLocation INNER JOIN tblRecords ON tblLocation.L_LocationID=tblRecords.LocationId) ON tblUnit.U_Unit_ID=tblLocation.L_UnitID) ON tblmonths.flddays=tblRecords.DateId
GROUP BY tblRecords.LocationId, tblLocation.L_Location_Name, tblUnit.U_Unit_Name, tblRecords.DateId, tblmonths.fldmonths, tblRecords.HRS, tblRecords.OT, tblRecords.EX, tblRecords.LTS, tblRecords.STS, tblRecords.AL, tblRecords.ML, tblRecords.SL, tblRecords.CL, tblRecords.UL, tblRecords.OL;
qryreport2 SQL:
SELECT qryreport1.LocationId, qryreport1.L_Location_Name, qryreport1.U_Unit_Name, qryreport1.DateId, qryreport1.fldmonths, Sum(qryreport1.OT) AS SumOfOT, Sum(qryreport1.EX) AS SumOfEX, Sum(qryreport1.LTS) AS SumOfLTS, Sum(qryreport1.STS) AS SumOfSTS, Sum(qryreport1.AL) AS SumOfAL, Sum(qryreport1.ML) AS SumOfML, Sum(qryreport1.SL) AS SumOfSL, Sum(qryreport1.CL) AS SumOfCL, Sum(qryreport1.UL) AS SumOfUL
FROM qryreport1
GROUP BY qryreport1.LocationId, qryreport1.L_Location_Name, qryreport1.U_Unit_Name, qryreport1.DateId, qryreport1.fldmonths;
Can anyone point me in the right direction with this.
I have a staff activity database i.e.; Over time, annual leave, sickness and I need to produce a monthly report. The information is recorded weekly with the weekending date entered as "dateID" and the staff grouped in locations. I have done a couple of queries to first group and them to sum the information. This is where I'm stuck, I am left with 4 weeks information for each location but I would like 4 weeks to show as 1 month.
Qryreport1 SQL:
SELECT tblRecords.LocationId, tblLocation.L_Location_Name, tblUnit.U_Unit_Name, tblRecords.DateId, tblmonths.fldmonths, tblRecords.HRS, tblRecords.OT, tblRecords.EX, tblRecords.LTS, tblRecords.STS, tblRecords.AL, tblRecords.ML, tblRecords.SL, tblRecords.CL, tblRecords.UL, tblRecords.OL
FROM tblmonths INNER JOIN (tblUnit INNER JOIN (tblLocation INNER JOIN tblRecords ON tblLocation.L_LocationID=tblRecords.LocationId) ON tblUnit.U_Unit_ID=tblLocation.L_UnitID) ON tblmonths.flddays=tblRecords.DateId
GROUP BY tblRecords.LocationId, tblLocation.L_Location_Name, tblUnit.U_Unit_Name, tblRecords.DateId, tblmonths.fldmonths, tblRecords.HRS, tblRecords.OT, tblRecords.EX, tblRecords.LTS, tblRecords.STS, tblRecords.AL, tblRecords.ML, tblRecords.SL, tblRecords.CL, tblRecords.UL, tblRecords.OL;
qryreport2 SQL:
SELECT qryreport1.LocationId, qryreport1.L_Location_Name, qryreport1.U_Unit_Name, qryreport1.DateId, qryreport1.fldmonths, Sum(qryreport1.OT) AS SumOfOT, Sum(qryreport1.EX) AS SumOfEX, Sum(qryreport1.LTS) AS SumOfLTS, Sum(qryreport1.STS) AS SumOfSTS, Sum(qryreport1.AL) AS SumOfAL, Sum(qryreport1.ML) AS SumOfML, Sum(qryreport1.SL) AS SumOfSL, Sum(qryreport1.CL) AS SumOfCL, Sum(qryreport1.UL) AS SumOfUL
FROM qryreport1
GROUP BY qryreport1.LocationId, qryreport1.L_Location_Name, qryreport1.U_Unit_Name, qryreport1.DateId, qryreport1.fldmonths;
Can anyone point me in the right direction with this.