Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Join syntax with subquery
Message
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Join syntax with subquery
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Desktop
Divers
Thread ID:
01588839
Message ID:
01588839
Vues:
47
I wonder if the join using the subquery would mean the query first selects all records that match code 805 and then does the join, or it would select only those from EmpItems that actually do match the where clause?

Let's say the EmpItems table has a lot of records, would the first join be substantially faster than the second?
...
LEFT OUTER JOIN EmpItems
ON Employees.emKey = EmpItems.itEmKey AND EmpItems.itCode = 10
LEFT OUTER JOIN 
	(SELECT EmpItems.itEmKey AS itEmKey,
	EmpItems.itPerc AS SpecialPerc
	FROM EmpItems
	WHERE EmpItems.itCode = 805)
	AS Item805
ON Employees.emKey = Item805.itEmKey
Christian Isberner
Software Consultant
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform