Re: can I use two join in a single query ?
Posted by:
Rick James
Date: October 03, 2012 07:56AM
Think of JOINs as being performed in the order listed. That's probably all you need to know, but here are some more details...
The query optimizer may reorder things, but not if it would change the result. (EXPLAIN SELECT ... show exactly what order will be used.)
The optimizer will remove "LEFT" in cases where it adds no constraint.
"INNER" and "OUTER" are ignored in MySQL.
STRAIGHT_JOIN prevents reordering by the optimizer -- this may help performance, but often bites you later.
Parentheses can be used for clarifying the semantics, but are rarely needed:
SELECT ... FROM a LEFT JOIN ( b JOIN c ON... ) ON ...
Try to avoid parens; they make it harder to read.
Subject
Written By
Posted
September 27, 2012 07:35AM
September 27, 2012 07:48AM
September 27, 2012 08:09AM
September 27, 2012 08:22AM
Re: can I use two join in a single query ?
October 03, 2012 07:56AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.