I am a newbie in SQL queries and am really struggling with the following query.
I have to implement something like this:
Select person.name, person.age, employee.yearsofservice
from person
join employee on person.name = employee.name
join fulltimeemployed on person.name = fulltimeemployed.name
join parttimeemployed on person.name = parttimeemployed.name
where fulltimeemployed.manager = 'Rob' or parttimeemployed.manager = 'Rob'
Basically I want to extract a list of all full time and part time employees who has their manager as ‘Rob’.
But the above query gives empty result since the employee cannot be present in both fulltimeemployed as well as parttime employed table.
So I need a way to implement a OR clause between those 2 joins (fulltimeemployed and parttimeemployed). Please suggest any ideas 🙁
You should do left outer joins for this: