Hi,

I have two models:
User
Post

User HABTM Post
Post HABTM User

How can I find the users with the most posts since a specified date?

Actually I have a third model PostsUser, which I implemented, to try a
few things. I can already find the users with the most posts, by doing
the following:

$this->User->bindModel(array('hasOne' => array('PostsUser')));

                         $users = $this->User->find('all', array(
                                'recursive' => 0, //int
                                'fields' => array('*','COUNT(PostsUser.post_id) 
AS num'),
                                'group' => 'User.id',
                                'order' => 'num DESC',
                                'limit' => 10 //I onlyneed the top10
                          ));

All I need is a way to only count the posts with post.created>
[given_date]

Any ideas?

Thanks
Donnerbeil

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to