Re: Selecting around a circular reference?

2008-09-08 Thread Brian Dunning
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 *

Re: Selecting around a circular reference?

2008-09-06 Thread Micah Stevens
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)

Selecting around a circular reference?

2008-09-05 Thread Brian Dunning
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