MySQL Forums :: General :: Is it possible to get MORE results by adding an AND clause to a SQL query?


Advanced Search

Is it possible to get MORE results by adding an AND clause to a SQL query?
Posted by: kris helenek ()
Date: November 05, 2010 10:00AM

For some reason I get more results after I add a superfluous AND clause to the end of a query, which I only tried out of desperation. The more I thought of this, that should never be possible, right? (Unless the and is part of an OR, but that's extending an existing clause, not adding a new one.)

Here's my query:
select l.address_id, d.location_address_id, a.id
from distance d, address a, location l
where member_latitude = 42.4039 and member_longitude = -71.1203 and distance < 25
and location_latitude = a.latitude and location_longitude = a.longitude
and l.address_id = d.location_address_id
#and a.id = l.address_id

If I run that I get 13 results. If I uncomment the last line I get 88. The results either way show that all three values involved are the same! It should be a redundant check right?

Is my database completely corrupt? Or having I been staring at it too long and missed something obvious.

Any help is appreciated, my site is in serious trouble until I fix this.

Options: ReplyQuote


Subject Written By Posted
Is it possible to get MORE results by adding an AND clause to a SQL query? kris helenek 11/05/2010 10:00AM
Re: Is it possible to get MORE results by adding an AND clause to a SQL query? Chad Bourque 11/05/2010 10:14AM
Re: Is it possible to get MORE results by adding an AND clause to a SQL query? kris helenek 11/05/2010 10:36AM
Re: Is it possible to get MORE results by adding an AND clause to a SQL query? Chad Bourque 11/05/2010 10:41AM
Re: Is it possible to get MORE results by adding an AND clause to a SQL query? kris helenek 11/05/2010 11:59AM
Re: Is it possible to get MORE results by adding an AND clause to a SQL query? Chad Bourque 11/05/2010 12:33PM
Re: Is it possible to get MORE results by adding an AND clause to a SQL query? laptop alias 11/06/2010 04:13AM
Re: Is it possible to get MORE results by adding an AND clause to a SQL query? Rick James 11/07/2010 02:32PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.