I've come here for help with a complicated query. I've tried a lot of different things for this and not quite got the results that I want. A watered down version of my schema is as follows: The three tables in question are an Employees Table, an EmployeeTraining Table, and a RequiredTraining table. The employees table holds information of an employee, such as empID,name, address, email, positionWorked, etc etc. The EmployeeTraining table holds an empID, and TrainingName.The RequiredTraining table has a Position and TrainingName.
Employees: empID, Name, Position
EmployeeTraining: empID, trainingName
requiredTraining: Position, trainingName
Here's some sample data, just to further clarify:
Employees
*EMPID~~Name~~Position~~
1 Ted Accountant
2 Bob Janitor
employeeTraining
**empID~~TrainingName**
1 Crunching Numbers
1 Microsoft Excel
1 Using an Abicus
2 Lemon Pledge 100
2 Scrubbing Toilets
requiredTraining
**position**~~**TrainingName**
Accountant Crunching Numbers
Accountant Microsoft Excel
Accountant Using an Abicus
Accountant TPS Reports
Janitor Lemon Pledge 100
Janitor Scrubbing Toilets
In english, and in the long run, I want to select an employee from a form and have a subform showing all of the training completed from that employee(SELECT * FROM Employees INNER JOIn EmployeeTraining on employees.empid = employeetraining.empID WHERE empID = me.empID)
I also want another subform that shows the training that an employee has NOT completed that is required for their current position. This is where I am struggling. I am not familiar or comfortable with using MS Access's query builder, but I have tried "find unmatched" queries as well as trying to write my own. This seems like a MINUS operation would work, but MS Access doesn't support MINUS. I have tried a LEFT JOIN with a null predicate as well as a NOT IN from the above query to a query of the requiredTraining table, but I haven't got the results I'm looking for.
For example, the result of the query I'm trying to write for this sample data would be:
for employeeID 1 (Ted the Accountant)
ted needs "TPS Reports" training
for employee 2 ( Bob the Janitor)
Bob has completed all of his training for his position.
An example of an attempted query I am trying is:
SELECT employees.position,employeeTraining.empid,employeetraining.TrainingName
FROM EmployeeTraining
InNER JOIN Employees ON EmployeeTraining.empid = employees.empid
WHERE empid = '1'
LEFT JOIN
SELECT TrainingName,Position FROM requiredTraining
ON EmployeeTraining.Training = RequiredTraining.Training
WHERE (((EmployeeTraining.Training is Null)))
Edit: This question has been answered. Thanks everyone for the help. Your queries, although each was different, all accomplished the goal.