Re: explode in mysql query
| From: | Zoltán Németh | Date: | Fri, 27 Apr 2007 06:40:19 +0000 |
| Subject: | Re: explode in mysql query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253945@lists.php.net to get a copy of this message | ||
2007. 04. 27, péntek keltezéssel 02.33-kor Sebe ezt írta:
> 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?
you'd better put the groups info in a separate table, referenced by this
table. then you can simply
SELECT t1.* FROM whatever t1, groups t2 WHERE t1.id=t2.whatever_id AND
(t2.group=7 OR t2.group=14);
greets
Zoltán Németh
> 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.
>