MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Hardik Doshi Date:July 24 2004 5:07pm
Subject:RE: Another newbie question - using OR in WHERE clauses
View as plain text  
Kevin's approach is much cleaner. If you have so many OR statements in a query then
Kevin's approach saves lots of string to be parsed by MySQL's query processor. 
 
Thanks,
Hardik

Kevin Ward <kevin@stripped> wrote:

Paul,

You can do the following:

SELECT * FROM tablename WHERE columname IN ('Bob','Mike','Betty');

Kevin

> -----Original Message-----
> From: Paul Fine [mailto:pfine@stripped] 
> Sent: Friday, July 23, 2004 3:01 PM
> To: mysql@stripped
> Subject: Another newbie question - using OR in WHERE clauses
> 
> Is there a simpler way to write something like:
> 
> 
> 
> SELECT * FROM tablename
> 
> WHERE columname = 'Bob' OR columname = 'Mike' OR columname = 'Betty'
> 
> 
> 
> 
> 
> Clearly this does not work:
> 
> WHERE columname = 'Bob' OR 'Mike' OR 'Betty' 
> 
> 
> 
> 
> 
> Thanks!
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=1


		
---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
Thread
Another newbie question - using OR in WHERE clausesPaul Fine23 Jul
  • RE: Another newbie question - using OR in WHERE clausesKevin Ward24 Jul
  • Re: Another newbie question - using OR in WHERE clausesScott Haneda24 Jul
RE: Another newbie question - using OR in WHERE clausesHardik Doshi24 Jul