SQL query to get the employee name and their manager name from the same table

You can self-join the table to get the manager’s name from his ID:

SELECT e.employee_name, m.employee_name AS manager_name
FROM   employee e
JOIN   employee m on e.manager_id = m.employee_id

Leave a Comment