E
esi
Trying to incorporate 2 left join queries into 1 combined query. Basically
I'm trying to get the total REG hours and OVT hours for each pay period and
each dept. I need to make sure that if hours do not exist for a given pay
period or dept, a null value is shown. I tried to left join Q1 with
qryTotalREGPayroll and qryTotalOVTPayroll in the same query but, I wound up
with results doubling the amount of SumOfTotal_REGHrs. Not sure how to
structure this query.
Left Query 1 Sql:
SELECT Q1.Month, Q1.Period, Q1.[Department Number],
Sum(qryTotalREGPayroll.Total_REGHrs) AS SumOfTotal_REGHrs
FROM Q1 LEFT JOIN qryTotalREGPayroll ON (Q1.[Department Number] =
qryTotalREGPayroll.Dept) AND (Q1.Period = qryTotalREGPayroll.Period)
GROUP BY Q1.Month, Q1.Period, Q1.[Department Number];
Left Query 2 sql:
SELECT Q1.Month, Q1.Period, Q1.[Department Number],
Sum(qryTotalOVTPayroll.Total_OVTHrs) AS SumOfTotal_OVTHrs
FROM Q1 LEFT JOIN qryTotalOVTPayroll ON (Q1.[Department Number] =
qryTotalOVTPayroll.Dept) AND (Q1.Period = qryTotalOVTPayroll.Period)
GROUP BY Q1.Month, Q1.Period, Q1.[Department Number];
I'm trying to get the total REG hours and OVT hours for each pay period and
each dept. I need to make sure that if hours do not exist for a given pay
period or dept, a null value is shown. I tried to left join Q1 with
qryTotalREGPayroll and qryTotalOVTPayroll in the same query but, I wound up
with results doubling the amount of SumOfTotal_REGHrs. Not sure how to
structure this query.
Left Query 1 Sql:
SELECT Q1.Month, Q1.Period, Q1.[Department Number],
Sum(qryTotalREGPayroll.Total_REGHrs) AS SumOfTotal_REGHrs
FROM Q1 LEFT JOIN qryTotalREGPayroll ON (Q1.[Department Number] =
qryTotalREGPayroll.Dept) AND (Q1.Period = qryTotalREGPayroll.Period)
GROUP BY Q1.Month, Q1.Period, Q1.[Department Number];
Left Query 2 sql:
SELECT Q1.Month, Q1.Period, Q1.[Department Number],
Sum(qryTotalOVTPayroll.Total_OVTHrs) AS SumOfTotal_OVTHrs
FROM Q1 LEFT JOIN qryTotalOVTPayroll ON (Q1.[Department Number] =
qryTotalOVTPayroll.Dept) AND (Q1.Period = qryTotalOVTPayroll.Period)
GROUP BY Q1.Month, Q1.Period, Q1.[Department Number];