J
Joost de Vries
I've got a question about the correct use of subqueries in Access reports.
I'm (still) working on a quality control system in Acces and right now I'm
creating management reports in the system. The report has the following
contents:
1. Team summary (total monthly quality)
2. Employee overview (montly quailty for the current month and for the pas
11 months)
I've tried using subqueries to calculate the employee totals per month and
the Sum() function to calculate team totals (the report is grouped first by
team, then by employee). But this causes a conflict with the grouping of the
report (Access gives the subqueries & levels error)...
The current SQL is something like:
SELECT employees.*, inspections_process_1.*, inspections_process_2.* FROM
(employees LEFT JOIN inspections_process_1 ON
employees.id=inspections.employee ) LEFT JOIN inspections_process_2 ON
employees.id=inspections_process_2.employee
WHERE (((employees.team)="1"));
The subqueries looked somthing like:
SELECT
(Sum(inspections_process_1.inspected)/Sum(inspections_process_1.mistakes))/Sum(inspections_process_1.inspected)
FROM inspections_process_1 WHERE iDate BETWEEN DateAdd("m",-12,Date()) AND
DateAdd("m",-11,Date())
I honestly have no idea how to get all the data I need and still preserve
the current grouping in the report. When I get rid of the grouping, I don't
no how to summarize the results per team..
Any ideas how to solve this?
I'm (still) working on a quality control system in Acces and right now I'm
creating management reports in the system. The report has the following
contents:
1. Team summary (total monthly quality)
2. Employee overview (montly quailty for the current month and for the pas
11 months)
I've tried using subqueries to calculate the employee totals per month and
the Sum() function to calculate team totals (the report is grouped first by
team, then by employee). But this causes a conflict with the grouping of the
report (Access gives the subqueries & levels error)...
The current SQL is something like:
SELECT employees.*, inspections_process_1.*, inspections_process_2.* FROM
(employees LEFT JOIN inspections_process_1 ON
employees.id=inspections.employee ) LEFT JOIN inspections_process_2 ON
employees.id=inspections_process_2.employee
WHERE (((employees.team)="1"));
The subqueries looked somthing like:
SELECT
(Sum(inspections_process_1.inspected)/Sum(inspections_process_1.mistakes))/Sum(inspections_process_1.inspected)
FROM inspections_process_1 WHERE iDate BETWEEN DateAdd("m",-12,Date()) AND
DateAdd("m",-11,Date())
I honestly have no idea how to get all the data I need and still preserve
the current grouping in the report. When I get rid of the grouping, I don't
no how to summarize the results per team..
Any ideas how to solve this?