Re: explode in mysql query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, April 27, 2007 1:33 am, Sebe wrote:
> i have a mysql column that looks like this:
>
> groups
> -------
> 12,7,10,6,14,11,2
>
> is it possible to select the row if `groups` contain 7 or 14?
> trying to avoid running two queries and running explode() on it.
>
> i don't remember but i thought there was a way to use explode() on
> something like this within a single query.

It's a MySQL question, but I suspect that the REGEXP operator in MySQL
would let you find these with something like:

groups REGEXP '\\b7\\b' or groups REGEXP '\\b14\\b'

The \\b being a word boundary, if I remember correctly...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux