How MySQL defines the JOIN order?
That's it, the questi开发者_Go百科on is in subject.
As of 5.0.12 MySQL tries to follow the SQL 2003 standard. Scroll down to the "Join Processing Changes in MySQL 5.0.12" section. http://dev.mysql.com/doc/refman/5.1/en/join.html
Basically never to commas to JOIN tables, always use the explicit JOIN syntax and MySQL joins in the order you specify (mostly).
Comma syntax (bad):
table1 JOIN table2, table3 WHERE table1.f1=table2.f1 AND ...
Explicit JOIN syntax (good):
table1
JOIN table2 ON table1.f1=table2.f1
JOIN table3 ON table1.f1=table3.f1 ...
精彩评论