Hi All.
I have Employees table
[Employee_ID] ,
[Employee_Name],
[Gender],
[Title],
[Manager_ID],
[Hire_Date],
[Salary],
[Commission],
[Department_ID]
I created query to get number of employees in the department and manager per employee.
SELECT
e.EMPLOYEE_ID,
e.EMPLOYEE_NAME,
e.MANAGER_ID,
d.EmpCount
FROM EMPLOYEES e
JOIN (SELECT DEPARTMENT_ID, COUNT(EMPLOYEE_ID) as EmpCount
FROM Employees
GROUP BY DEPARTMENT_ID) d
ON e.DEPARTMENT_ID = d.DEPARTMENT_ID
How to get Manager_Name instead Manader_ID which is part of employees?
Thanks