List:General Discussion« Previous MessageNext Message »
From:Jonathan Mangin Date:April 5 2008 4:25pm
Subject:Re: Incorrect results from sum
View as plain text  
----- Original Message ----- 
From: "Jake Peavy" <djstunks@stripped>
To: "Jonathan Mangin" <jon.mangin@stripped>
Cc: <mysql@stripped>
Sent: Saturday, April 05, 2008 11:59 AM
Subject: Re: Incorrect results from sum

> On 4/5/08, Jonathan Mangin <jon.mangin@stripped> wrote:
>> I'm getting incorrect results from a sum and wonder if
>> anyone sees something obviously wrong. (Won't surprise
>> me.) Leaving 'simple' out of the equation (or adding
>> 'simple' values manually) gets me the correct number.
>> select round(sum($menu.carb * units) + simple.carb,2)

I was hoping for a syntax error on the above line. This has
worked fine until I added simple. 

>> from itemized inner join simple on itemized.uid = simple.uid
>> inner join $menu on itemized.personal_id = $
>> where itemized.uid = ? and between ? and ?
>> group by date;
>> It's supposed to return 253.08, but I keep getting 260.36.
> Your "bug" is likely in the GROUP BY.
> -- 
> -jp
There is only one day's meals stored and a difference of 7.28
relates to no stored values. Thanks anyway.

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