Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EXISTS
Message
From
09/02/2001 23:42:35
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Re: EXISTS
Miscellaneous
Thread ID:
00473986
Message ID:
00474696
Views:
21
Mike,

Which is more efficient? (runs faster?) I assume in the first case the subquery is run ONCE but in the second it is run once for each record in titles, but only getting one record.

>You can use both NOT IN and NOT EXIST to generate the same results. The following examples show this. You can run them in the Pubs sample database.
>
>
>SELECT *
>FROM titles
>WHERE title_id NOT IN (
>	SELECT title_id
>	FROM sales )
>
>SELECT *
>FROM titles
>WHERE NOT EXISTS (
>	SELECT *
>	FROM sales
>	WHERE sales.title_id = titles.title_id)
>
>
>I'm not sure why you're having problems. Are there NULLs in the vcRequestor or TolasKey columns maybe?
>
>-Mike
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform