Tuesday, March 27, 2012

DTS Query Builder - Using nulls

I am trying to emulate the "Find unmatched Records" Access Query using DTS. I have a small table with a list of codes that I need to use to exclude records in my text export.

I have created a left outer join and set the criteria for the joined field in the 'right' table to be null. I am repeatedly getting no records as a result.

Wouldn't the joined field in the right table for unmatched records by default be null? I'm stumped as to why this seamingly simple process won't work for me. I have attached the select statement for your review.

Any help would be greatly appreciated.Maybe you should re-design your query using the "where exists" or "where not exists" construct

something like:

select a, b from table1
where not exists (select * from table2 where table1.key = table2.key)|||Thanks. That worked like a charm.

No comments:

Post a Comment