Wednesday, 15 June 2011

sql - Why are the two queries different (left join on ... and ... as opposed to using where clause) -



sql - Why are the two queries different (left join on ... and ... as opposed to using where clause) -

i'm wondering why next 2 queries produce different results (the first query has more rows second).

select * bring together ... bring together ... bring together c on ... left bring together b on b.id = a.id , b.otherid = c.otherid

as opposed to:

select * bring together ... bring together ... bring together c on ... left bring together b on b.id = a.id b.otherid = c.otherid

please help me understand. in sec query, left bring together has 1 status shouldn't include results first query , more (where rows have unmatched otherid). where clause should ensure otherid matches, in first query. why different?

the where performed first query engine before performing join. reasoning beingness why expensive join, if going filter rows later. query engines pretty @ optimizing query write.

also see effect in outer joins. in inner joins both where , join conditions behave same.

sql oracle

No comments:

Post a Comment