This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LEFt OUTER JOIN returning extraneous results...

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys...I have a left outer join query, and i noticed it returned too many results...
So now Im testing its logic by simplifying it.
I decided to do a control test, where the query returns 0 results.

I implemented this test by putting 1=0 as a criteria in the where clause (see below) ...

Anyways. My query is returning results !!! Why ? Shouldnt the 1=0 statement always evaluate to false, thus
making the only set of attributes which satisfy this criteria the null set (i.e. the empty set )?

 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The last set of OR clauses aren't wrapped in parens

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay... Thanks !!!

But this raises another question about left outer joins...

The idea of the left outer join is that someone wants to see all the records from A, along with any entries from table B,C,D,E... etc.

But if thats the case, how are constraints applied to rows on the non essential tables in a left outer join ?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic