This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes LEFt OUTER JOIN returning extraneous results... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "LEFt OUTER JOIN returning extraneous results..." Watch "LEFt OUTER JOIN returning extraneous results..." New topic
Author

LEFt OUTER JOIN returning extraneous results...

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
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

Joined: Oct 10, 2000
Posts: 1364
The last set of OR clauses aren't wrapped in parens

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
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 ?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LEFt OUTER JOIN returning extraneous results...