You cannot compare value to the Null because the result will be always Null. Use Isnull() function to check if value is null.
select rs.acctno, rs.clientcode, r.trans_no ;
from Rssched rs ;
left outer join rsmast r ;
on rs.trans_no = r.trans_no ;
where ISNULL(r.trans_no) ;
into table RSCConfRpt
Or use subquery
select rs.acctno, rs.clientcode ;
from Rssched rs ;
Where rs.trans_no NOT IN ( Select r.trans_no From rsmast r) ;
into table RSCConfRpt
>Hello,
>
>I am trying to find all non-matching records between two tables. When I merely JOIN the tables like this ...
>
>select rs.acctno, rs.clientcode, r.trans_no ;
>from Rssched rs ;
>left outer join rsmast r ;
> on rs.trans_no = r.trans_no ;
>into table RSCConfRpt
>
>I get many NULL records in my r.trans_no field as expected.
>However, when add a where clause to limit the result set to just NULL records, like this .....
>
>select rs.acctno, rs.clientcode, r.trans_no ;
>from Rssched rs ;
>left outer join rsmast r ;
> on rs.trans_no = r.trans_no ;
>where r.trans_no = .NULL. ;
>into table RSCConfRpt
>
>I get no records whatsoever ! trans_no in both tables have indexes, and both will accept NULL values.
>
>Thank in advance, Ken
--sb--