Table 1 (Qualifications_Acquired)
ID employeeID qualID jobID Expire
1 203 1 1 11/11/2019
2 204 1 2 11/12/2019
3 205 1 1 11/11/2019
4 205 2 1 11/11/2019
Table 2 (Qualifications)
qualID Qual_Title
1 First Aid
2 Company Induction
3 Working at heights
4 Face Fit
5 Confined Spaces
Table 3 (Jobroles)
jobID Job_Name
1 Manager
2 Supervisor
Table 4 (Compliance)
ID jobID qualID
1 1 1
2 1 2
3 1 3
4 2 3
5 2 4
6 2 5
I need a query that shows me if an employee has all the qualifications (and not expired) needed for his job title from the Compliance Table.
For instance:
Job_Name employeeID qualID Compliant
Manager 203 1 True
Manager 203 2 False
Manager 203 3 False
Manager 205 1 True
Manager 205 2 True
Manager 205 3 False
Supervisor 204 3 False
Supervisor 204 4 False
Supervisor 204 5 False
I've been working on this for days trying different ways but just get tangled up and nowhere. Can someone help me please?