左连接

testtable1   testtable2 

select t2.id,t2.dptid,nvl(t1.department,'黑人'),t2.name from testtable2 t2 left join testtable1 t1 on t2.dptid=t1.id;

结果:

原文地址:https://www.cnblogs.com/feng666666/p/5899757.html