Sorry, let me try and explain a bit better:

Table:

Field1          Field2          Field3  

anne            typist          good    
betty           reception       fair
sandy           typist          excellent
elise           pa              bad
dana            reception       excellent
cindy           reception       bad


Now, I want to look for all receptionists AND typists that are "good" OR
"excellent"
So, I would expect to get back only anne,sandy and dana.
And my sql would look like:
select * from table where field2 = typist or field2 = reception and
field3 = good or field3 = excellent.

Hope this helps you to help me ;)
                

On Fri, 2002-09-13 at 00:27, Norris, Joseph wrote:
> 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
> 


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