I have a table employees which has this structure:
ID | firstName | lastName | reportsTo | jobTitle |
--------------------------------------------------
I want to do a single query, which will show me firstName, lastName of employee and which employee He/She does report to (in this column, it contain ID of the employee).
So example of table data:
ID | firstName | lastName | reportsTo | jobTitle |
----------------------------------------------------
35 | John | Green | 36 | TeamLeader |
----------------------------------------------------
36 | Annie | Red | null | Supervisor |
----------------------------------------------------
So John Green has ID 35 and he reports to Annie Red. How to do this in a query?
So far I have come with basic:
SELECT ID, firstName, lastName from employees;
Thanks