$this->Member->find('count', ...)
it should be in the cookbook, the documentation of cakephp


On 14 Aug., 22:29, Roland Pish <[email protected]> wrote:
> Hello.
> I need to issue a query like:
>
> select count(id) as total,status from members group by status
>
> When specifying the fields for the model find method I do this:
>
> $fields = array('count(Member.id) as total','Member.status');
> $members = $this->Member->find('all',array('fields'=>
> $fields,'group'=>'Member.status'));
>
> But the resulting array doesn't put 'total' field within
> $members['Member'] but in $members[0]. How should I write the 'total'
> field in order to be pushed into $members['Member']?
>
> Thanks in advance

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to