Reputation: 1998
I have query below that gives me the employee and mangagers for that employee based off a self join,
select e.name as employeename, m.name as managername
from employee e
left join employee m
on e.mgr_id = m.emp_id
where e.doj < m.doj
I know when left joining the first table being joined has to be filtered in the where clause and second in on, what would I do here since the filter contains both tables or in a different example where its not self joined and its joined on 2 different tables but the filter contains both tables? Thanks
Upvotes: 0
Views: 138
Reputation: 1401
you could left join on e.doj < m.doj instead of using the where clause
Upvotes: 1