How many OR, AND in a query?

2001-09-26 Thread Mysql List

Hi,
How many OR or AND can I put in a select query statement?
ex:
 WHERE mycolumn = 1 OR mycolumn = 3 OR mycolumn = 23   etc . . . 

A thousand? How would that affect the database execution time?



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How many OR, AND in a query?

2001-09-26 Thread Jonothan Farr

You might want to try:

WHERE mycolumn in (1, 3, 23, ...)

Or even better, put your thousand records into a temporary table and then just do a 
join.

--jfarr

- Original Message - 
From: Mysql List [EMAIL PROTECTED]
To: mysql [EMAIL PROTECTED]
Sent: Wednesday, September 26, 2001 12:06 PM
Subject: How many OR, AND in a query?


 Hi,
 How many OR or AND can I put in a select query statement?
 ex:
  WHERE mycolumn = 1 OR mycolumn = 3 OR mycolumn = 23   etc . . . 
 
 A thousand? How would that affect the database execution time?
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How many OR, AND in a query?

2001-09-26 Thread Richard Brown

If you use just 1 OR you will force a table scan and slow everything down ?


- Original Message -
From: Mysql List [EMAIL PROTECTED]
To: mysql [EMAIL PROTECTED]
Sent: 26 September 2001 20:06
Subject: How many OR, AND in a query?


 Hi,
 How many OR or AND can I put in a select query statement?
 ex:
  WHERE mycolumn = 1 OR mycolumn = 3 OR mycolumn = 23   etc . . . 

 A thousand? How would that affect the database execution time?



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How many OR, AND in a query?

2001-09-26 Thread Gerald Clark

Well, a column can't be one value AND another value.

Mysql List wrote:

 in() is usefull for OR ing, but is there a way to do this AND ing?
 
 
 
 
 You might want to try:
 
 WHERE mycolumn in (1, 3, 23, ...)
 
 Or even better, put your thousand records into a temporary table and then
 
 just do a join.
 
 --jfarr
 
 - Original Message -
 From: Mysql List [EMAIL PROTECTED]
 To: mysql [EMAIL PROTECTED]
 Sent: Wednesday, September 26, 2001 12:06 PM
 Subject: How many OR, AND in a query?
 
 
 
 Hi,
 How many OR or AND can I put in a select query statement?
 ex:
  WHERE mycolumn = 1 OR mycolumn = 3 OR mycolumn = 23   etc . . . 
 
 A thousand? How would that affect the database execution time?
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 
 [EMAIL PROTECTED]
 
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How many OR, AND in a query?

2001-09-26 Thread Mysql List

in() is usefull for OR ing, but is there a way to do this AND ing?



 You might want to try:

 WHERE mycolumn in (1, 3, 23, ...)

 Or even better, put your thousand records into a temporary table and then
just do a join.

 --jfarr

 - Original Message -
 From: Mysql List [EMAIL PROTECTED]
 To: mysql [EMAIL PROTECTED]
 Sent: Wednesday, September 26, 2001 12:06 PM
 Subject: How many OR, AND in a query?


  Hi,
  How many OR or AND can I put in a select query statement?
  ex:
   WHERE mycolumn = 1 OR mycolumn = 3 OR mycolumn = 23   etc . . . 
 
  A thousand? How would that affect the database execution time?
 
 
 
  -
  Before posting, please check:
 http://www.mysql.com/manual.php   (the manual)
 http://lists.mysql.com/   (the list archive)
 
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail
[EMAIL PROTECTED]
  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How many OR, AND in a query?

2001-09-26 Thread Adams, Bill TQO

Gerald Clark wrote:

  You might want to try:
 
  WHERE mycolumn in (1, 3, 23, ...)
 
  Or even better, put your thousand records into a temporary table and then
 
  just do a join.
 
  --jfarr

I have yet to have a query that is to long when talking to MySQL via DBD, however, I 
believe
that ODBC has some limitations either compiled in or set at run/query time.

--Bill


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php