|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: Unexpected behaviour: SELECT with OR returns empty set
From: gerald_clark (gerald_clark
suppliersystems.com)
Date: Fri Jul 02 2004 - 08:01:44 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am not sure what you are trying to do.
Do you want a join, or a union.
Your query is neither, and the results are correct as written.
Dave Gibson wrote:
>Hi,
>I'm getting some unexpected behaviour from a query and was
>hoping someone could shed some light on whether it's a user
>error or something else.
>
>I have two tables:
>customers, oems which both have a companyID field (marked
>as a foreign key).
>When I do:
> SELECT * FROM customers WHERE customers.companyID = 1509
>I get 4 rows returned.
>However, when I do:
> SELECT * FROM customers,oems WHERE ((customers.companyID
>= 1509 ) OR (oems.companyID) = 1509)
>I get 0 rows matched.
>
>Investigation showed that the oems table contains no rows.
>If I add a rown to it, even one that doesn't match the
>query above, I get the correct result.
>
>ring any bells with anyone?
>
>Thanks,
>Dave
>
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]