RE: [PHP-DB] Delicious style Tags table
| From: | Simcha Younger | Date: | Thu, 11 Sep 2008 18:33:36 +0000 |
| Subject: | RE: [PHP-DB] Delicious style Tags table | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-45394@lists.php.net to get a copy of this message | ||
I did a little testing, and this should work better:
Select...
From...
group by taggings.id
HAVING GROUP_CONCAT('name') like 'soup'
AND GROUP_CONCAT('name') like 'vegetarian'
Simcha Younger
-----Original Message-----
From: Catharsis [mailto:chris.lock@thisisbd.com]
Sent: Thursday, September 11, 2008 6:44 PM
To: php-db@lists.php.net
Subject: RE: [PHP-DB] Delicious style Tags table
Simcha Younger-2 wrote:
>
> If there is only one search term - "soup" your where statement would be:
> Where
name like 'soup'
>
> But you need two matches, and the terms are "soup", "vegetarian". Try:
> Where GROUP_CONCAT('name') like 'soup'
> AND GROUP_CONCAT('name') like 'vegetarian'
> group by taggings.id
>
You might be onto something, couldn't get your suggestion to work out the
box but after looking at the docs
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_grou
p-concat