Reputation: 13
i need to retrieve all employees who are not working as managers
i tried with this code >
SELECT MGR.LAST_NAME ,
E.EMPLOYEE_ID
FROM EMPLOYEES E , (SELECT M.LAST_NAME ,
M.EMPLOYEE_ID
FROM EMPLOYEES E , EMPLOYEES M
WHERE E.MANAGER_ID = M.EMPLOYEE_ID) MGR
WHERE E.EMPLOYEE_ID = MGR.EMPLOYEE_ID
Upvotes: 1
Views: 6095
Reputation: 10452
SELECT
E.LAST_NAME,
E.EMPLOYEE_ID
FROM EMPLOYEES E
WHERE EMPLOYEE_ID not in
(SELECT MANAGER_ID FROM EMPLOYEES where MANAGER_ID is not null)
Upvotes: 2