Access Bottom Up Query / Detail-Master Queries Examples
Select parent records based on the values in a child table - there are times when you need to retrieve master records based on criteria in a detail record.
We will assume that you have two tables in a master detail relationship.
The master is M_Employees and the detail is M_Attendance.
These are linked by the Employee_ID field.
Our goal is to find the name and number of the employees that have missed more than 5 days of work.
Select M_Employees.Name, M_Employees.Emp_Number
From M_Employees
Where M_Employees.Employee_ID in
(Select Employee_ID from M_Attendance Group By Employee_ID Having Count(M_Attendance.Day_Missed) >= 5);