M
Melinda
I have two queries, 1st query is for overtime hours worked and 2nd query is
for overtime hours refused. My criteria is by a overtime code that the
person choose when entering the overtime for plowing snow. I joined those
two queries into another to get a sumofhours refused and sumof hours worked
for a YTD total hours of overtime. The problem is I have two field names
sumofhours and get an error "The specified field <field> could refer to more
than one table listed in the FROM clause of your SQL statement" Do I go
back to the table that I retried the hours from, do I refer to the query. I
am sure there was a way to extract that data with one query, but I was
struggling, so I made two queries and have now joined them. Below is my
SQL statement.
SELECT henryqry.Tmsemployeeno, henryqry.EmployeeName, henryqry.ClassNo,
henryqry.OutPost, Sum(henryqry.SumOfHoursWorked) AS SumOfSumOfHoursWorked,
Sum(refusedqry.SumOfHoursWorked) AS SumOfSumOfHoursWorked1,
Sum([sumofhoursworked])+nz([sumofhoursworked]) AS totalhours
FROM henryqry LEFT JOIN refusedqry ON henryqry.Tmsemployeeno =
refusedqry.TMSEmployeeNo
GROUP BY henryqry.Tmsemployeeno, henryqry.EmployeeName, henryqry.ClassNo,
henryqry.OutPost
HAVING (((henryqry.ClassNo)<>"11111"));
Thanks Melinda
for overtime hours refused. My criteria is by a overtime code that the
person choose when entering the overtime for plowing snow. I joined those
two queries into another to get a sumofhours refused and sumof hours worked
for a YTD total hours of overtime. The problem is I have two field names
sumofhours and get an error "The specified field <field> could refer to more
than one table listed in the FROM clause of your SQL statement" Do I go
back to the table that I retried the hours from, do I refer to the query. I
am sure there was a way to extract that data with one query, but I was
struggling, so I made two queries and have now joined them. Below is my
SQL statement.
SELECT henryqry.Tmsemployeeno, henryqry.EmployeeName, henryqry.ClassNo,
henryqry.OutPost, Sum(henryqry.SumOfHoursWorked) AS SumOfSumOfHoursWorked,
Sum(refusedqry.SumOfHoursWorked) AS SumOfSumOfHoursWorked1,
Sum([sumofhoursworked])+nz([sumofhoursworked]) AS totalhours
FROM henryqry LEFT JOIN refusedqry ON henryqry.Tmsemployeeno =
refusedqry.TMSEmployeeNo
GROUP BY henryqry.Tmsemployeeno, henryqry.EmployeeName, henryqry.ClassNo,
henryqry.OutPost
HAVING (((henryqry.ClassNo)<>"11111"));
Thanks Melinda