OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Unexpected behaviour: SELECT with OR returns empty set

From: Dave Gibson (winteeyahoo.com)
Date: Fri Jul 02 2004 - 07:32:00 CDT


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