Add it to the conditions string, in the same way as `group by`:
$this->Author->bindModel(array(
'hasOne' => array(
'Post' => array(
'fields' => array()
)
)
);
$data = $this->Author->find('all', array(
'recursive' => 0,
'fields' => 'Author.*, COUNT(Post.id) AS num_posts',
'conditions' => '1=1 GROUP BY Author.id HAVING num_posts>5',
'order' => 'num_posts DESC'
))
hth
grigri
On May 13, 9:47 am, David <[EMAIL PROTECTED]> wrote:
> Hey folks, I need to run a findAll using HAVING instead of WHERE. Is
> there a way to do this without having to manually construct a set of
> queries? I'm using 1.2b. Your help is greatly appreciated.
>
> Best,
> David
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---