re: using OR seems faster than using IN

2005-05-17 Thread James Black
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have a query where I am fetching, in my test 68, rows. Using OR was faster by about 1.5 times, than the same query using IN. Should this be expected, using mysql 5.0.4, on Solaris 8, java 1.5. SELECT name, id FROM table WHERE idx=? OR idx=? OR idx

Re: Using OR

2004-03-12 Thread Johan Hook
Hi Keith, you can use: pla.type IN ('1','2','3','4'); /Johan Keith wrote: is there any alternative to using OR for selecting between values? ie: pla.type='1' OR pla.type='2' OR pla.type='3' OR pla.type='4' Cheers, Keith -- Johan Höök, Pythagoras Engineering Group - MailTo:[EMA

Re: Using OR

2004-03-12 Thread Alan Williamson
Keith wrote: is there any alternative to using OR for selecting between values? ie: pla.type='1' OR pla.type='2' OR pla.type='3' OR pla.type='4' Keith for stuff like this i try and arrange things in numerical blocks so i am doing selects like pla.type >= 1 AND play.type <= 4, probably not need

Re: using OR in select statement with distinct results

2003-09-18 Thread Sam Folk-Williams
Thanks everyone, I suspected it was something quite simple. Sam Matt W wrote: - Original Message - From: "Paul DuBois" Sent: Thursday, September 18, 2003 8:17 PM Subject: Re: using OR in select statement with distinct results At 7:47 PM -0500 9/18/03, Sam Folk-Williams wrot

Re: using OR in select statement with distinct results

2003-09-18 Thread Matt W
- Original Message - From: "Paul DuBois" Sent: Thursday, September 18, 2003 8:17 PM Subject: Re: using OR in select statement with distinct results > At 7:47 PM -0500 9/18/03, Sam Folk-Williams wrote: > >Hi, > > > >I keep having this fundamental proble

Re: using OR in select statement with distinct results

2003-09-18 Thread Kelley Lingerfelt
Won't putting the first OR in parenthesis, fix it up? SELECT t1.title, t2.auth_name FROM t1, t2, WHERE (cat_id = 1 OR cat_id = 2) AND t1.auth_id = t2.auth_id KL Sam Folk-Williams wrote: > Hi, > > I keep having this fundamental problem. It seems like this should be > easy enough, but whenever I

Re: using OR in select statement with distinct results

2003-09-18 Thread Paul DuBois
At 7:47 PM -0500 9/18/03, Sam Folk-Williams wrote: Hi, I keep having this fundamental problem. It seems like this should be easy enough, but whenever I have a query where I'm using OR in the WHERE clause and the query is performed on multiple tables, I get strange results. For example: SELECT