In the last episode (Jul 06), [email protected] said:
> From: "Highviews" <[email protected]>
> > 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
        [email protected]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[email protected]

Reply via email to