Mariappan Subramanian
Mariappan Subramanian

Reputation: 10063

left join with three tables

Can anyone explain what will happen in following scenario?

SELECT * 
FROM A,
     B 
LEFT JOIN C 
       ON B.FIELD1=C.FIELD1 
WHERE A.FIELD1='SOME VALUE'

Here table A and table B are not joined with any condition. So my doubt is what kind of join will be applied between A and B?

Upvotes: 1

Views: 73

Answers (3)

code save
code save

Reputation: 1106

Please try it

SELECT * FROM A INNER JOIN B ON  A.IDCOLUMND=B.IDCOLUMN  LEFT JOIN C ON B.FIELD1=C.FIELD1 

Upvotes: 0

Lakmal Vithanage
Lakmal Vithanage

Reputation: 2777

A cross join applies, If you don't used a join condition, get irrelavent results also.

Upvotes: 0

Denis de Bernardy
Denis de Bernardy

Reputation: 78413

A cross join (cartesian product, if you prefer) will be applied between the results of A and B left join C: each row in the first set will be tied to each row in the second set.

Upvotes: 4

Related Questions