In an employee table, some rows have the same value for the reportsTo
column.
employeeNumber | reportsTo
---------------|-----------------
1056 | 1002
1076 | 1002
1088 | 1056
1102 | 1056
1143 | 1056
...
I want to be able to show the employee numbers of employees who report to the same person as does a particular employee.
For e.g. I want to know the other employees who report to the same person as employeeNumber 1088
The output should be:
| employeeNumber |
|----------------|
| 1088 |
| 1102 |
| 1143 |
What simple MySQL statement I can use to get this result?