Re: OR in Query String

2005-08-10 Thread Devananda
Justin Palmer wrote: Hi List, I have the following query where I am trying to locate a single students record. I only know that the students record has an id of 3690 and an employer_id of 3 possibles. So I thought that OR would work great. The problem is that it returns all students with empl

Re: OR in Query String

2005-08-10 Thread Roger B.A. Klorese
Justin Palmer wrote: Hi List, I have the following query where I am trying to locate a single students record. I only know that the students record has an id of 3690 and an employer_id of 3 possibles. So I thought that OR would work great. The problem is that it returns all students with emp

Re: OR in query doesn't use keys?

2004-02-17 Thread Bill Marrs
At 01:54 PM 2/17/2004, walt wrote: >> (SELECT FROM table WHERE condition1) UNION (SELECT FROM table WHERE >> condition2); Ah, interesting... I'll play around with UNION to see if that will do the trick for me. Right off the bat, I am able to get a fast query with it, but the output isn't quite,

Re: OR in query doesn't use keys?

2004-02-17 Thread walt
Bill, Someone sent this too the list the other day. >> MySQL's optimizer has a slight problem. OR queries cause it to get very >> confused. >> >> Try the following to get the best performance: >> >> Rewrite SELECT FROM table WHERE (condition1) OR (condition2); >> >> As: >> >> (SELECT FROM table WH

RE: OR in QUERY

2001-08-07 Thread Chris Bolt
> is there any way turn the following query to all ands instead of using an > or? > > select f1,f2,f3 from table1 where (f1 ='monday' or f2 ='monday') and > f3='34'; SELECT f1,f2,f3 FROM table1 WHERE 'monday' IN (f1, f2) AND f3 = '34'; --