Re: explode in mysql query

From: Date: Fri, 27 Apr 2007 19:18:18 +0000
Subject: Re: explode in mysql query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-254008@lists.php.net to get a copy of this message
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?

« previous php.general (#254008) next »