Simcha Younger-2 wrote:
> I did a little testing, and this should work better:
> Select...
> From...
> group by
> 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
properly, e.g.

SELECT GROUP_CONCAT( ) AS tags,  `taggings` . * 
FROM  `tags` 
LEFT JOIN  `taggings` ON ( = taggings.tag_id ) 
GROUP BY taggings.taggable_id
AND GROUP_CONCAT( ) LIKE  '%vegetarian%'
I'll do some testing when I get time on lots of tags and see which of the
methods (I now have 3) is fastest.

View this message in context:
Sent from the Php - Database mailing list archive at

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to