Subject Re: [firebird-support] Re: SQL Question - "Not In" Query
Author Daniel Rail
Hi,

At September 16, 2004, 00:57, ra8009 wrote:


> Thanks for the tip. Do you mean that the syntax you suggested is more
> efficient?

I don't know about the fastest, but it will give you all orphan
orders. Not just the orders where CUST_ID is null, but also those
where ORDERS.CUST_ID is not found in CUSTOMERS. This is useful if by
mistake a customer was deleted without the corresponding orders being
deleted, I'm pretty sure your application does deal with that, but
just in case you forgot to implement that logic or someone deleted a
customer directly from the database.

> Is that becuase my syntax will first perform the join and
> then narrow it down to just the ones that are NULL?

When it comes to find orphaned orders like this, you got to be
thorough.

--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)