Thanks for that, but it didn't work in the end for what I needed to do. This is the code I ended up with in my model, so anyone working with a cloud tag can give it a try:
function tagcloud() { return $this->query("SELECT `Tag`.`id`, `Tag`.`tag`, (SELECT COUNT(`pages_tags`.`page_id`) FROM `pages_tags` WHERE `pages_tags`.`tag_id` = `Tag`.`id`) + (SELECT COUNT(`posts_tags`.`post_id`) FROM `posts_tags` WHERE `posts_tags`.`tag_id` = `Tag`.`id`) + (SELECT COUNT(`events_tags`.`event_id`) FROM `events_tags` WHERE `events_tags`.`tag_id` = `Tag`.`id`) + (SELECT COUNT(`images_tags`.`image_id`) FROM `images_tags` WHERE `images_tags`.`tag_id` = `Tag`.`id`) AS `count` FROM `tags` AS `Tag` ORDER BY RAND() LIMIT 30;"); } Tane On 5/14/07, Vladimir <[EMAIL PROTECTED]> wrote: > > select tags.id,tags.tag, count(posts_tags.post_id) as c1, > count(images_tags.post_id) as c2, count(events_tags.post_id) > from tags, posts_tags, images_tags, events_tags > where tags.id=posts_tags.tag_id and tags.id=images_tags.tag_id and > tags.id=events_tags.tag_id > group by (tags.id); > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---