You can use also:
Quote:
SELECT *
FROM employee e
Left Join
department d
On d.deptno = e.workdept
Where d.deptno is Null
|
with the same result.
For better understand how it works you can play with sample:
Quote:
select emp.*, dpt.dept
from
(
select 2 empid, 1 dept from sysibm.sysdummy1
union all
select 3 empid, 5 dept from sysibm.sysdummy1
union all
select 4 empid, 7 dept from sysibm.sysdummy1 ) emp
Left Join
(
select 1 dept from sysibm.sysdummy1
union all
select 7 dept from sysibm.sysdummy1 ) dpt
on emp.dept = dpt.dept
where dpt.dept is null
|
First time execute without "where dpt.dept is null", then execute whole query.
Lenny
