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;