Join rules example 2 |
A report lists equipment units and shows the assigned repair shop name and department name for each equipment unit. The report should also show the account name for the account ID assigned to each department (not the account ID assigned to the equipment unit).
Solution:
Select the Equipment table (EQ_MAIN), the Locations table (LOC_MAIN), the Departments table (DPT_MAIN), and the Accounts table (ACT_MAIN)
Connections required:
FROM the Equipment table TO the Locations table, through the Assigned repair shop ID field
FROM the Equipment table TO the Departments table, through the Department ID field
FROM the Departments table TO the Accounts table, through the Account ID field for the assigned department (not the account ID field for the equipment unit)
Required restriction:
LOC_MAIN.LOC_loc_code = EQ_MAIN.LOC_assign_repr_loc
DPT_MAIN.DEPT_dept_code = EQ_MAIN.DEPT_dept_code
ACT_MAIN.ACCT_acct_code = DPT_MAIN.ACCT_acct_code