我正在研究 MySQL 数据库。我有一张桌子empreporting
,这张桌子包含
employeeid
和reportingemployeeid
列
SELECT e3.`ReportingEmployeeId` AS Level0,e2.`ReportingEmployeeId` AS Level1,e1.`ReportingEmployeeId` AS Level2,e1.`EmployeeId` AS Level3
FROM empreporting e1
LEFT JOIN empreporting e2 ON e1.`ReportingEmployeeId` = e2.`EmployeeId`
LEFT JOIN empreporting e3 ON e2.`ReportingEmployeeId` = e3.`EmployeeId`
上述查询给出以下结果:
0 级 1 级 2 级 3 级 \N \N 379 369 \N 379 484 372 \N \N \N 379
要求的结果格式是:
0 级 1 级 2 级 3 级 379 369 \N \N 379 484 372 \N 第379章
请任何人帮助我。提前致谢
普拉卡什