You need parenthesis around cond1 OR cond2 OR cond3 otherwise effectively you 
are going to get all records matching the following:
last "d" AND choice1="2" + choice2="2" + choice3="2"

Therefore, you select statement should be written:
SELECT * FROM name WHERE last LIKE "d" AND (choice1="2" OR choice2="2" OR 
choice3="2");

Bernard

On Friday 07 May 2004 13:51, Bob Cohen wrote:
> Here's my question.  I wrote this query:
>
> Select * FROM name WHERE last LIKE "d" AND choice1="2" OR choice2="2" OR
> choice3="2";
>
> What I'm looking for are records that satisfy the LIKE "d" condition
> But then, Only one of the three other conditions need be true:
>       choice1=2
>       choice2=2
>       choice3=2
>
> I want to cover the possibilities, e.g.,
>
>       choice1=2
>       choice2=1
>       choice3=1
>
>       choice1=1
>       choice2=2
>       choice3=whatever
>
> Or
>       choice1=1
>       choice2=1
>       choice3=2
>
> Does this make sense?  The query I've written doesn't seem quite right.
> Because of the AND following the LIKE "d" condition, it seems like all
> the records will have to have choice2 equaling 2.
>
> Some help clarifying this issue would be appreciated.  Thanks.
>
> Bob Cohen
> b.p.e.Creative
> http://www.bpecreative.com
> Design and production services for the web
> Put creative minds to work for you


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to