Jonathan Mangin schrieb:
I'm trying to total certain nutrients consumed on a given date
(though I've removed date temporarily).
You'll see I have three items (in two meals) in itemized,
and two meal totals in simple.
mysql select id, item, carb from my_menu where id in (10, 11, 22);
On Tue, Apr 15, 2008 at 4:21 AM, Sebastian Mendel
[EMAIL PROTECTED] wrote:
use UNION
You can't use UNION to add the results of two queries. It would
return two rows.
- Perrin
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
Perrin Harkins schrieb:
On Tue, Apr 15, 2008 at 4:21 AM, Sebastian Mendel
[EMAIL PROTECTED] wrote:
use UNION
You can't use UNION to add the results of two queries. It would
return two rows.
of course!
you need to use this UNION as subquery
sorry for being not imprecise
--
Sebastian
--
Sorry to return to this topic, I haven't found a lot to explain
what's happening.
I'm trying to total certain nutrients consumed on a given date
(though I've removed date temporarily).
You'll see I have three items (in two meals) in itemized,
and two meal totals in simple.
mysql select id,
On Mon, Apr 14, 2008 at 5:40 PM, Jonathan Mangin [EMAIL PROTECTED] wrote:
select
round(sum(my_menu.carb * units) + sum(simple.carb),2)
from itemized inner join simple using (uid)
left join my_menu on itemized.personal_id = my_menu.id;
Instead of 218.3 this returns 602, which is
(52.9
Hi,
On Sun, Apr 6, 2008 at 12:54 AM, Perrin Harkins [EMAIL PROTECTED] wrote:
On Sat, Apr 5, 2008 at 9:28 PM, Jonathan Mangin [EMAIL PROTECTED] wrote:
select itemized.day_date as day_date,
round(sum(my_menu.carb * units) + simple.carb,2)
from itemized inner join simple using (uid)
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.
$menu is a personalized table of meal/recipe ingredients.
itemized is a list of
On 4/5/08, Jonathan Mangin [EMAIL PROTECTED] 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.
$menu is a
- Original Message -
From: Jake Peavy [EMAIL PROTECTED]
To: Jonathan Mangin [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Saturday, April 05, 2008 11:59 AM
Subject: Re: Incorrect results from sum
On 4/5/08, Jonathan Mangin [EMAIL PROTECTED] wrote:
I'm getting incorrect results
PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Saturday, April 05, 2008 11:59 AM
Subject: Re: Incorrect results from sum
On 4/5/08, Jonathan Mangin [EMAIL PROTECTED] wrote:
I'm getting incorrect results from a sum and wonder if
anyone sees something obviously wrong. (Won't surprise
me.) Leaving
Hi,
Here's the basic query I'm trying. It's supposed to return
the totals of each nutrient (carb, in this case) by date.
The data totals 218.31, but I get 190.80.
select itemized.day_date as day_date,
round(sum(my_menu.carb * units) + simple.carb,2)
from itemized inner join simple using (uid)
On Sat, Apr 5, 2008 at 9:28 PM, Jonathan Mangin [EMAIL PROTECTED] 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
12 matches
Mail list logo