Re: Stupid Newbie Query Help with AND and OR logical operators

2004-05-08 Thread Eldo Skaria
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 con

Re: Stupid Newbie Query Help with AND and OR logical operators

2004-05-08 Thread Ingo Thierack
hi, you should set parentheses on it Select * FROM name WHERE last LIKE "d" AND (choice1="2" OR choice2="2" OR choice3="2"); without it interprets it as like "d" and choice1="2" or choice2="2" or choice3="2" Regards Ingo Thierack --On Freitag, 7. Mai 2004 13:51 -0400

Re: Stupid Newbie Query Help with AND and OR logical operators

2004-05-08 Thread Michael Stassen
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"; To predict the outcome of this query requires knowledge of the precedence of AND vs. OR in mysql. I can't find it documented anywhere, but I think AND

RE: Stupid Newbie Query Help with AND and OR logical operators

2004-05-08 Thread Bob Cohen
Thanks to Bernard, Sunmaia, and Ingo! I knew the query wasn't quite right. 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 unsubscr

Re: Stupid Newbie Query Help with AND and OR logical operators

2004-05-08 Thread Bernard Clement
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 ch