Ahmed Rashad
Ahmed Rashad

Reputation: 13

how Display the names of employees who are not working as managers?

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

Answers (1)

Tom Studee
Tom Studee

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

Related Questions