Just now. It gives me:
Invalid use of group function.
On Sep 6, 2008, at 2:47 PM, Micah Stevens wrote:
Did you try this?
SELECT
sum(fooditems.carb * mealitems.quantity) as sumcarbs,
sum(fooditems.gi * ((fooditems.carb * mealitems.quantity) /
sum(fooditems.carb *
Did you try this?
SELECT
sum(fooditems.carb * mealitems.quantity) as sumcarbs,
sum(fooditems.gi * ((fooditems.carb * mealitems.quantity) /
sum(fooditems.carb * mealitems.quantity))),
sum(fooditems.gl * mealitems.quantity),
sum(fooditems.cal * mealitems.quantity)
I'm trying to calculate glycemic index of all food items eaten in a
day with a single SELECT. The problem is the calculation for glycemic
index of each item requires a total of all items' carbs. It's like a
circular reference. Here's what I'm trying:
SELECT