On Mar 25, 8:47 pm, donnerbeil <[email protected]> wrote:
> All I need is a way to only count the posts with post.created>
> [given_date]

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

.... substituting $someDate with the date you're wanting.
--~--~---------~--~----~------------~-------~--~----~
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