Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WHERE IN syntax for Exist/Not Exist
Message
From
29/01/2017 09:47:19
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
OS:
Windows 8.1
Network:
Windows Server 2012
Miscellaneous
Thread ID:
01647092
Message ID:
01647111
Views:
35
>Most times when people use IN, they use it with a subquery that isn't written as a correlated subquery.
>
>Again, what you have works. (Admittedly, when I read it, I wondered if it would generate an error, because I assumed...dangerous world....that IN would not work with subqueries that referenced a table from the outer query).
>
>If you were worried about NULL values in the Province table, then EXISTS might be better (EXISTS certainly works better if you have to search on multiple columns)
>
>Maybe Naomi or Sergey or someone else who has run into this can jump in - admittedly this was the first time I'd ever seen an IN with a subquery written as a correlated subquery. It seemed a bit odd and I was actually surprised it worked. But maybe I'm missing something.

Exists might have been a better choice actually. Thanks
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform