On 12 Sep 2002, at 23:48, Petre Agenbag wrote:

> select * from table where field1 = "x" and ((field2 = "y" or field2 =
> "z") or (field3 = "a" or field3 = "b" or field3 = "c"));
> 
> But this syntax is not returning what I expect.

The syntax looks fine (though the inner sets of parentheses aren't 
necessary).  You don't tell us what you expect, so how are we 
supposed to know how your expectation differs from what happens?

Another way to write the query is

   SELECT * FROM table1 WHERE field1 = 'x' AND ( field2 IN ('y', 'z')
        OR field3 IN ('a', 'b', 'c') );

but that should give you the same results, so if they're not what you 
expect you'll have to explain further.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to