General information
Category:
Coding, syntax & commands
>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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only