Dave --
I'm not sure about that. You have a correlated subquery here which requires that the subquery be performed for each record of the result set in the main query. Tamar noted this a couple weeks ago, and that's SOP for other SQL implementations AFAIK. I think the original NOT IN syntax would give the preferred performance.
Jay
>Randall,
>
>A faster way to do this:
>
>
select tableA.* ;
> from tableA ;
> into cursor missing ;
> where not exists ;
> ( select keyfield from tableB where tableB.keyfield = tableA.keyfield )
>
>NOT IN requires much more work to be done by the SQL engine.
>
>>I just thought about it. This does give me a table with everyrthing that is there but I still will have not idea of what's missing. For example, table A has 100,000 records in it. The result table gomes up with 95,000 matches. How do I know of the 5000 records in table A are missing in table B? I was thinking I could mark them some how. Then I would have a table of what was not in there. Maybe I could change the code to say NOT IN?