H. Ferrence
H. Ferrence

Reputation: 8116

Proper order syntax for MySQL INNER JOIN ON (Basic Q)

I have the following MySQL query statement:

SELECT * 
FROM table1 INNER JOIN table2 
    ON table1.id = table2.id 
WHERE 1

Does it matter if my inner join on statement is table1.id = table2.id vs. table2.id = table1.id?

Upvotes: 0

Views: 154

Answers (1)

Ike Walker
Ike Walker

Reputation: 65547

There is no functional or performance difference between the two options you presented.

It's purely a stylistic choice.

Personally I prefer this style, but I'm sure there are others who do it differently:

SELECT ... 
FROM table1 
INNER JOIN table2 ON table2.id = table1.id 
INNER JOIN table3 ON table3.id = table1.id 
WHERE ...

Upvotes: 2

Related Questions