>From the cookbook (http://book.cakephp.org/view/1030/Complex-Find-Conditions):
• array('fields'=>array('Product.type','MIN(Product.price) as price'),
'group' => 'Product.type');
Jeremy Burns
Class Outfit
http://www.classoutfit.com
On 14 Aug 2011, at 22:54, Roland Pish wrote:
> Thanks for your reply euromark.
> I tried the find->('count'.... but it just returns a number, not the
> records grouped by 'status' field.
>
> On 14 ago, 15:09, euromark <[email protected]> wrote:
>> $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
--
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