Information générale
Catégorie:
Codage, syntaxe et commandes
>should the select begin with the parent or the greatgrandchild table, or doesn't it matter? IE
>
>select * from parent ;
>inner join child on ... ;
>inner join grandchild on ... ;
>inner join greatgrandchild on ... ;
>where somecondition
>
>or
>
>select * from greatgrandchild ;
>inner join grandchild on ... ;
>inner join child on ... ;
>inner join parent on ... ;
>where somecondition
>
>Is this a matter of form or is there a significant difference? Is one preferred as a best practice?
If you're doing only inner joins, the order doesn't matter. As Naomi said, the engine will decide the best order to perform the joins.
When outer joins are involved, the order is significant as it may change the results.
Tamar
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement