父子关系展示

--1、

select t1.deptno, t1.dname, t2.empno, t2.ename, t2.mgr
  from dept t1
  left join emp t2
    on t1.deptno = t2.deptno
 order by t1.deptno, t2.empno;

 


--2、

select t2.empno employer_no,
       t2.ename employer_name,
       t1.empno employee_no,
       t1.ename employee_name
  from emp t1
  left join emp t2
    on t2.empno in t1.mgr;

 



posted @ 2017-07-07 17:43  Oracle-fans  阅读(599)  评论(0编辑  收藏  举报