Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EXISTS
Message
De
08/02/2001 10:39:00
Greg Coopman
Gc Systems Corporation
Hollywood, Floride, États-Unis
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
EXISTS
Divers
Thread ID:
00473986
Message ID:
00473986
Vues:
47
What is the difference between the two following Selects. It seems that they should return the same results, but the "NOT IN" produces 0 records and the EXISTS clause produces multiple rows. I thought that they should return the same result.

Using "NOT EXISTS":
SELECT DISTINCT u1.[vcRequestor]
FROM dbPDRProductionCopy..tbl_PDR u1
WHERE NOT EXISTS
(SELECT u2.[TolasKey]
FROM Core..User_tbl u2
WHERE u1.[vcRequestor] = u2.[TolasKey])

Using "NOT IN":

SELECT DISTINCT u1.[vcRequestor]
FROM dbPDRProductionCopy..tbl_PDR u1
WHERE u1.[vcRequestor] NOT IN
(SELECT u2.[TolasKey]
FROM Core..User_tbl u2)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform