Or use a virtual field.

On Aug 15, 11:44 am, Roland Pish <rolandp...@gmail.com> wrote:
> Thanks Jeremy.
> I looked at the cookbook with the link you provided and I realized
> that I'm having the same output as the example showed there, the
> 'MIN(Product.price) as price' field is returned in the array with 0 as
> its index but not 'Product' as its index.
> Now I know that I'm doing it the right way :) and I will have to deal
> with the 0 index, but no problem at all.
>
> Thanks!
>
> On 14 ago, 22:26, Jeremy Burns | Class Outfit
>
>
>
> <jeremybu...@classoutfit.com> wrote:
> > 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 <dereurom...@googlemail.com> wrote:
> > >> $this->Member->find('count', ...)
> > >> it should be in the cookbook, the documentation of cakephp
>
> > >> On 14 Aug., 22:29, Roland Pish <rolandp...@gmail.com> 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 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to