Hi.
The main model is a Post. A post hasMany Postview.
I need to get the most viewed (popular) posts.
I'm hoping to use Model::find() to build this query (or something like
it..):
select
Post.id,
Post.name,
Post.slug,
count(Postview.id) as views
from
posts AS Post,
postviews AS Postview
where
Post.id = Postview.post_id
group by Post.id
order by views desc
limit ' . $limit
Could you please help me?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---