Posts

Showing posts with the label northwind

Northwind database | SQL query that returns employees and who they report to

Northwind database | SQL query that returns employees and who they report to I am trying to write a query for the Northwind database that lists the employees and their manager's names, without including employees who have no one to report to. Here is what I have so far: SELECT employees.firstname, employees.lastname, superior.firstname, superior.lastname FROM employees LEFT OUTER JOIN employees superior ON employees.reportsto = superior.employeeID WHERE employees.reportsto <> null; This query runs, but nothing appears. Sorry about the checking and unchecking the answer buttons for you guys repeatedly! I thought that I could pick more than one answer. 😥 – Help pls Apr 17 '17 at 13:47 Tip of today: Declare table aliases for both employees instances, to make the code clearer. – jar...