Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WHERE IN approach
Message
De
01/03/2017 12:44:52
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2014
OS:
Windows 8.1
Network:
Windows Server 2012
Divers
Thread ID:
01648591
Message ID:
01648679
Vues:
24
>Normally EXISTS is used in situations where you need to correlate one table with another. In your case where is no correlation, so the above is better written as
>
>if exists(select 1 from ForumCli where NoMember = 1 and NoClient IN (1,2))
>
>   select Numero from Thread where NoStatus = 1
>
>else
>
>    select Numero from Thread where 1=0 -- to produce empty result
There is always at least one child record as per that condition. But, thanks for mentioning it.
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform