Simcha Younger-2 wrote:
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'
Yep, that works also, just to clarify it needed %'s either side to work
Evert Lammerts-2 wrote:
Your 'taggings' table is basically a link table to deal with a 'many
to many' relationship - i guess you know:
You have a table A and a table B that have a many-to-many
relationship, which is stored in table L. What query fetches all rows
in A that relate to all
Your 'taggings' table is basically a link table to deal with a 'many
to many' relationship - i guess you know:
You have a table A and a table B that have a many-to-many
relationship, which is stored in table L. What query fetches all rows
in A that relate to all members of the set [B1, B2, ...,
SELECT `tags`.*, count(taggable_id) as cnt, `taggings`.* FROM `tags`
JOIN `taggings` ON tags.id = taggings.tag_id WHERE (name IN ('vegetarian',
'soup', 'lunch', 'curry')) group by taggable_id
Evert Lammerts-2 wrote:
Your 'taggings' table is basically a link table to deal with a 'many
to
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'
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')
, 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