Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record Comaprisons
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00330776
Message ID:
00331947
Views:
14
>> I was hoping that someone would be able to give me a better solution because the analyzer shows table scans and even with indexs it doesn't perform any better.

This doesn't surprise me. It's difficult for the optimizer to optimize NOTs. You could try converting to an outer join and looking for NULLs:

SELECT id FROM b WHERE b.id NOT IN (SELECT id FROM a)

becomes

SELECT id
FROM b LEFT OUTER JOIN a
ON b.id = a.id
WHERE a.id IS NULL

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform