Hey folks,
I've got a little dilemma. Using the tagging code from the bakery, I
have implemented a tag cloud that fits in with my code, so far so good
- but it only does a count on tags that are associated with my Post
model as per below:
function tagcloud() {
return $this->query("SELECT `Tag`.`id`, `Tag`.`tag`,
COUNT(posts_tags.post_id) as
count
FROM `posts_tags`
JOIN `tags` as `Tag` ON
`posts_tags`.`tag_id` = `Tag`.`id`
JOIN `posts` as `Post` ON
`posts_tags`.`post_id` = `Post`.`id`
WHERE `Post`.`published` = '1'
GROUP BY(tag_id)
ORDER BY RAND(),`Tag`.`tag`
ASC, `Post`.`id` DESC LIMIT 30");
}
What I would like to do is in the same query, it to also count tags
associated with other model types that I tag such as Page, Image,
Event, etc. I'm not an expert with MySQL and this is pretty much as
far as my knowledge extends. I've had a look on google, but cannot
seem to find anything that allows me to do a count with multiple
joins.
Can anyone please help?
Tane
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---