List:General Discussion« Previous MessageNext Message »
From:Bryan Cantwell Date:February 17 2010 5:33pm
Subject:RE: compare column value to anything in a list of values
View as plain text  
A simple IN would not match if the actual value of the values column is litterally
''produce(grape,orange,pear,apple,lettuce)' and you want to see if  any one of
('apple','orange','banana') is in there....

________________________________
From: drydell@stripped [drydell@stripped]
Sent: Wednesday, February 17, 2010 11:31 AM
To: Cantwell, Bryan
Subject: Re: compare column value to anything in a list of values

yes, there is... IN

SELECT * FROM tbl WHERE col IN ("v1", "v2", "v3")

----- Original Message -----
From: "Cantwell, Bryan"
Date: Wednesday, February 17, 2010 12:25 pm
Subject: compare column value to anything in a list of values
To: "mysql@stripped"

> Is there a simple function or method to compare a value in a
> column to one or more items in a comma separated list?
>
> select * from table where value
> ('apple','orange','banana');
> and say value may = something like
> 'produce(grape,orange,pear,apple,lettuce)'--
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>

Thread
compare column value to anything in a list of valuesBryan Cantwell17 Feb
RE: compare column value to anything in a list of valuesBryan Cantwell17 Feb
Re: compare column value to anything in a list of valuesWm Mussatto17 Feb
  • RE: compare column value to anything in a list of valuesJay Blanchard17 Feb
    • Re: compare column value to anything in a list of valuesBaron Schwartz19 Feb