Saturday, November 28, 2009

Re: Multiple SUM in query

See: http://book.cakephp.org/view/74/Complex-Find-Conditions
CTRL+F: "How about GROUP BY?" on that page. See the MIN() usage, I'd
just try to use it twice (and SUM instead of MIN)

On Nov 29, 2:13 am, Dave <davidcr...@gmail.com> wrote:
> They really let you use PHP Frameworks for your homework?
>
> On Sat, Nov 28, 2009 at 3:13 PM, John Andersen <j.andersen...@gmail.com>wrote:
>
> > Please copy/paste the find statement into the post, so that we better
> > may be able to see what may be the problem ;)
> > Enjoy,
> >    John
>
> > On Nov 28, 3:48 pm, Robin Marx <marx.ro...@gmail.com> wrote:
> > > Since I can't seem to find the answer on google, nor in the docs, I
> > > hope someone here can help me.
>
> > > Whenever I try to do a query with more then 1 SUM-field in it, it will
> > > only return the first SUM-field, not the other ones in its results.
>
> > > So for instance :
>
> > > SUM( amount1 ) as amountOne, SUM( amount2 ) as amountTwo  +   group on
> > > year
>
> > > will only return amountOne as result.
>
> > > When I do :
>
> > > SUM( amount2 ) as amountTwo,  SUM( amount1 ) as amountOne  +   group
> > > on year
>
> > > it will only return amountTwo.
>
> > > Anyone got an idea why this behaviour occurs and how to fix it?
>
> > > We would be most grateful because it's quite urgent for a school
> > > project.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: