>>
>>LEFT is ALWAYS the table from FROM clause (or if you do further JOINs the FIRST table).
>>
>>
>>FROM Table1
>> LEFT JOIN Table2 ON ..
>> LEFT JOIN Table3 ON Table2.Some = Table3.Some
>>
>>LEFT for the first JOIN is Table1, for the Second JOIN is Table2.
>>As Tamar said, the JOIN condition doesn't matters.
>
>Tamar & Borislav - Thank you much. This clears up a misconception I have had for a while. I guess it never came up before because I never used a right join before.
>
>Borislav - You bring up an interesting question. I wanted the second join in your example to be between table1 and table3, would that be possible?
>
>
>
>Tamar - This whole discussion originated because I was trying to speed up this query which takes a couple of minutes whereas the other half of my query is similar (and produces more records) but runs almost instantly. The 2 tables are similar in size. Can you suggest why this is the case and how I can speed things up? There are no indexes set.
Use SYS(3054) to find out how the engine is executing the query.
As for why it would be different, while the order of inner joins doesn't matter, with outer joins, the order makes a difference. Inner joins in a query can be performed in any order and you get the same results. But with outer joins, the joins have to be done in a particular order and that can affect optimization.
Tamar