List:General Discussion« Previous MessageNext Message »
From:<avrombay Date:July 7 2009 1:50am
Subject:Re: How to use LIKE for detecting numbers with commas?
View as plain text  
It's ugly, but this should work:

SELECT * FROM table where numbers LIKE '8,%' or  numbers LIKE '%,8,%' or 
numbers LIKE '%,8'

-- B


----- Original Message ----- 
From: "Highviews" <highviews@stripped>
To: <mysql@stripped>
Sent: Monday, July 06, 2009 6:31 PM
Subject: How to use LIKE for detecting numbers with commas?


> Hi,
> 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%';
>
> The above query when executed returned the following:
> ROW1: 10,5,2,8,
> ROW3: 99,100,55,10,88,
>
> Where it should only return ROW1:
> ROW1: 10,5,2,8,
>
> But it is also detecting '88' from ROW2.
>
> Any solution to this?
> I only want exact numbers to be searched out.
>
>
> Thanks!
>
>
>
> ---
> http://www.visualbooks.com.pk/
> 


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