select * from dept1;
create table injon as
select d1.deptno as d1no,d1.dname as d1name,d1.loc as d1loc,--查询表dept1的数据
d2.deptno as d2no, d2.dname as d2name,d2.loc as d2loc,--查询表dept2的数据
d.deptno as dno,d.dname as dname, d.loc as dloc--查询表dept的数据
from dept1 d1 --要关联的表
left join dept2 d2 --先关联d2
on d1.deptno = d2.deptno
left join dept d --再关联的d1
on d.deptno = d1.deptno
order by d1.deptno;
select * from injon;