List:General Discussion« Previous MessageNext Message »
From:Perrin Harkins Date:April 6 2008 4:54am
Subject:Re: Incorrect results from sum
View as plain text  
On Sat, Apr 5, 2008 at 9:28 PM, Jonathan Mangin <jon.mangin@stripped> wrote:
>  select itemized.day_date as day_date,
>  round(sum(my_menu.carb * units) + simple.carb,2)
>  from itemized inner join simple using (uid) inner join my_menu on
> itemized.personal_id = my_menu.id where itemized.uid = 'me' and
>  itemized.date between '2008-03-28' and '2008-04-01' group by
>  day_date;

You are not using a grouping operator on simple.carb or naming it in
the GROUP BY clause, so you will get a random result from its possible
values in each group.

- Perrin
Thread
Incorrect results from sumJonathan Mangin5 Apr
  • Re: Incorrect results from sumJake Peavy5 Apr
  • Re: Incorrect results from sumJonathan Mangin5 Apr
    • Re: Incorrect results from sumPeter Brawley5 Apr
  • Re: Incorrect results from sumJonathan Mangin6 Apr
    • Re: Incorrect results from sumPerrin Harkins6 Apr
      • Re: Incorrect results from sumBaron Schwartz7 Apr