-- 显示员工和上级领导 员工表的领导编号=领导表的员工编号 不能写反了 select e.empno as '员工号', e.ename as '员工姓名', e.mgr as '领导的员工号', l.ename as '领导的姓名' from emp e left join emp l on e.mgr=l.empno;
员工号 |员工姓名 |领导的员工号|领导的姓名| ----+------+------+-----+ 7369|SMITH | 7902|FORD | 7499|ALLEN | 7698|BLAKE| 7521|WARD | 7698|BLAKE| 7566|JONES | 7839|KING |
标签:ename,BLAKE,领导,员工,99,姓名,where,连接 From: https://www.cnblogs.com/haha1988/p/17866105.html