let's say i have three tables, each one relates to another,
when i need to get a column from each table, does it make difference how to organize the (inner joins)??
Select table1.column1,table2.column2,table3.column2
From table1
Inner Join table2 on ..... etc
Inner Join table3 on .....
in another words, can i put (table2) after (From )??
Select table1.column1,table2.column2,table3.column2
From table2
Inner Join table1 on ..... etc
Inner Join table3 on .....
For most queries, order does not matter.
That said...
The inner join
operation has left to right associativity. It doesn't matter much in which order you write the tables, as long as you don't refer to any tables in the ON condition before they have been joined.
When the statement is executed the database engine will determine the best order to execute the join and this may be different from the order they appear in the SQL query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With