Wont each food have a value for each nutrient? Or do you assume the value is 0 if the there is no row in the nutrient_data table?
I cant see why you dont put a field for the value of each nutrient in the food_descriptions table? Since every food will have a value for each of these, it makes sense doesnt it?
Then you could just do:
Code:
SELECT description, carb, protein, fibre
FROM food_descriptions
WHERE food_id = 888
GCT13, you last solution returns 3 rows which chromate wasnt too keen on either, and doesnt return the food description - not sure if you want that too chromate?
Chromate, I realise this is similar to darkanes suggestion, but I dont think you have said why you have a separate table for the value of each nutrient of each food.
Bookmarks