Re: explode in mysql query

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

 



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.
> 

-- 
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