RE: [PHP-DB] Delicious style Tags table

2008-10-03 Thread Catharsis
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

Re: [PHP-DB] Delicious style Tags table

2008-09-12 Thread Evert Lammerts
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

Re: [PHP-DB] Delicious style Tags table

2008-09-11 Thread Evert Lammerts
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, ...,

Re: [PHP-DB] Delicious style Tags table

2008-09-11 Thread Catharsis
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

RE: [PHP-DB] Delicious style Tags table

2008-09-11 Thread Simcha Younger
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'

RE: [PHP-DB] Delicious style Tags table

2008-09-11 Thread Catharsis
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')

RE: [PHP-DB] Delicious style Tags table

2008-09-11 Thread Simcha Younger
, 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