I would write this in this way:

select * from table where (field = "x" and ($field = "y" or field = "z"))
or (field = "x" and (field = "a" or field = "b" or field = "c"));

assuming that you want a record with "x" in field having either

y or z in field or a or b o c in field

HATH

-----Original Message-----
From: Petre Agenbag [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 2:49 PM
To: [EMAIL PROTECTED]
Subject: and & or in query


Hi
I would like to issue a logical query as follow:

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.

Plz help me with syntax
 



---------------------------------------------------------------------
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

---------------------------------------------------------------------
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