List:General Discussion« Previous MessageNext Message »
From:Highviews Date:July 7 2009 7:44pm
Subject:Re: How to use LIKE for detecting numbers with commas?
View as plain text  
Thats Great!

Thanks a Ton!


:)




On Mon, Jul 6, 2009 at 7:55 PM, Dan Nelson <dnelson@stripped> wrote:

> In the last episode (Jul 06), avrombay@stripped said:
> > From: "Highviews" <highviews@stripped>
> > > I have numbers separated with commas saved into a TEXT Field, for
> > > example:
> > >
> > > ROW1: 10,5,2,8,
> > > ROW2: 2,7,9,65
> > > ROW3: 99,100,55,10,88,
> > > etc...
> > >
> > > Now i want to make a query like this:
> > > SELECT * FROM table where numbers LIKE '%8%';
> > >
> > > Any solution to this?
> > > I only want exact numbers to be searched out.
> >
> > It's ugly, but this should work:
> >
> > SELECT * FROM table where numbers LIKE '8,%' or  numbers LIKE '%,8,%' or
> > numbers LIKE '%,8'
>
> Even better:
>
>  SELECT * FROM table WHERE find_in_set('8',numbers);
>
>
> http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_find-in-set
>
>
> --
>        Dan Nelson
>        dnelson@stripped
>

Thread
How to use LIKE for detecting numbers with commas?Highviews7 Jul
  • Re: How to use LIKE for detecting numbers with commas?avrombay7 Jul
    • Re: How to use LIKE for detecting numbers with commas?Dan Nelson7 Jul
      • Re: How to use LIKE for detecting numbers with commas?Highviews7 Jul
  • Re: How to use LIKE for detecting numbers with commas?Colin Streicher7 Jul