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

OR in Query String

2005-08-10 Thread Justin Palmer
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 employer_id's of 3, 78, 79.

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

OR in query doesn't use keys?

2004-02-17 Thread Bill Marrs
I've noticed that If I use an OR in my query, mysql seems to choose not to use my indexes. Though, it would seem to help (as, if I do the query in two steps, I can get faster results than as one query). Is there some way I can convince mysql to use my keys with an OR, or perhaps another way to

mysql getting stuck with use of or in query

2002-12-15 Thread ashish shrivastav
There is a really strange thing happening with mysql 3.23.52. mysql is getting stuck in a select query, the query is a straight join between table a,b and c The problem arises when i give condition to search c.nId for 2 values then it is taking large amount of time to excute this query and is g

RE: and & or in query

2002-09-12 Thread Petre Agenbag
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:

RE: and & or in query

2002-09-12 Thread Norris, Joseph
uot;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

Re: and & or in query

2002-09-12 Thread Keith C. Ivey
On 12 Sep 2002, at 23:48, Petre Agenbag wrote: > 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. The syntax looks fine (though the inner sets of parentheses aren'

and & or in query

2002-09-12 Thread Petre Agenbag
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 ---

help with replacing OR in query

2002-08-12 Thread Erick Papadakis
p.s., if you reply, kindly CC me as well. hi, i have the following SQL query select col1 from table1 where col2 = 'xxx' or col3 = 'xxx' how can i get rid of this OR? due to my table design and the logic involved, i have to check both these 2 columns (in a search function). i cannot

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

OR in QUERY

2001-08-07 Thread Randy Johnson
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'; Thanks Randy - Before posting, please check: http://www.mysql.co