Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimization Questions
Message
De
08/02/2007 10:07:06
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Optimization Questions
Divers
Thread ID:
01193611
Message ID:
01193611
Vues:
53
I have a few optimization questions about SQL queries.

First, what syntax would be preferred to join two tables:
... FROM (Table_1 INNER JOIN Table_2 ON Table_1.Col = Table_2.Col)
INNER JOIN Table_3 ON Table_1.Col = Table_3.Col ...
or
... FROM Table_1, Table_2, Table_3 WHERE Table_1.Col = Table_2.Col AND
Table_1.Col = Table_3.Col ...
Second, is a JOIN or a Subquery usually most efficient:
SELECT Customer.CustomerID, Customer.CustomerName, Status.StatusName
FROM Customer INNER JOIN Status on Customer.Status = Status.StatusID
or
SELECT CustomerID, CustomerName, (SELECT StatusName FROM Status WHERE Status.StatusID = Customer.Status) AS Status
FROM Customer
Very fitting: http://xkcd.com/386/
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform