Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding Missing Records
Message
 
 
À
31/10/2017 13:53:54
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Divers
Thread ID:
01655302
Message ID:
01655308
Vues:
33
>Thanks, it looks like that is in effect the same thing I posted as seeming to work. Is there any advantage to using the CTE version over my plain and simple version?
>
>>I misread your original requirement
>>
>>;with allCombinations as (select I.*, B.* from Items I, Branches B)
>>
>>select AC.* from allCombinations AC where not exist (select 1 from BranchItems BI where BI.ItemId = AC.ItemID and BI.BranchId = AC.BranchID)
>>
The exists part in your query should be simplified (e.g. just use BrachItems as I did). Other than that I used CTE for clarification and maintenance point only - no need to use CTE and you can use it directly.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform