Solved programming problem

Show the employee name and no of employees who is hired before him

Source code

SELECT e.EMPLOYEE_ID,COUNT(e2.EMPLOYEE_ID)

FROM employees AS e  

    JOIN 

    employees AS e2 

    ON e.MANAGER_ID != e2.EMPLOYEE_ID

WHERE e.HIRE_DATE < e2.HIRE_DATE     

GROUP BY e.EMPLOYEE_ID;
Join the discussion

Add your comment