Re: Incorrect results from sum
- Date: Sun, 6 Apr 2008 00:54:42 -0400
- From: "Perrin Harkins" <perrin@xxxxxxxx>
- Subject: Re: Incorrect results from sum
On Sat, Apr 5, 2008 at 9:28 PM, Jonathan Mangin <jon.mangin@xxxxxxxxxxx> 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
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx