Employees under Terminated Manager

We have given task as -

For which we written query as

SELECT 
e.emp_id,
SUBSTR(e.emp_fname || ' ' || e.emp_lname, 1, 10) AS emp_Name, 
SUBSTR(m.emp_fname || ' ' || m.emp_lname, 1, 10) AS mgr_Name, 
count(m.emp_status) as mgr_status,
SUBSTR(s.emp_fname || ' ' || s.emp_lname, 1, 10) AS mgr_supervisor
from emp e
INNER JOIN emp m ON e.mgr_id = m.emp_id and m.emp_status='Terminated'
INNER JOIN emp s ON m.mgr_id = s.emp_id
group by e.emp_id,SUBSTR(e.emp_fname || ' ' || e.emp_lname, 1, 10), SUBSTR(m.emp_fname || ' ' || m.emp_lname, 1, 10) ,m.emp_status ,
SUBSTR(s.emp_fname || ' ' || s.emp_lname, 1, 10)  ;

Not getting desire result. Does our joining condition is f9? Please help us

Is this some homework or test?

1 Like