Write a SELECT statement to show a list of all employees' first names and their managers' first
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a SELECT statement to show a list of all employees' first names and their managers' first names. List only employees that have a
manager. Order the results by Employee first name. Use aliases to give the result columns distinctly different names, like "Employee and
"Manager".
Hint: Join the Employee table to itself using INNER JOIN.
I have the code, however I have the employees as managers and the managers as the employees in the table. Here is the code I have.
SELECT emp.FirstName AS Employee, mgr.FirstName as Manager FROM Employee AS emp
INNER JOIN Employee AS mgr
ON emp.ID = mgr.ManagerID
ORDER BY mgr.ManagerID; no
Related Book For
Posted Date: