ResolutionsNET
IS-IT--Management
Hi,
I've got a problem, I need a SQL query that I can't get my head around can anybody help??
I have 5 tables
Recipes - id, name
FoodType - id, name
MealType - id, name
RecipeFoodRelation - recipe id and foodtype id
RecipeMealRelation - recipe id and Mealtype id
I want to be able to list the Recipe ids, its name and it's food type for a particlue meal type.
I've tried various methods but I keep getting some duplicate records.
The nearest I've got is something like this
select a.RecipeID, c.Name, b.FoodTypeID
from RecipeMealRelation a, FoodRecipeRelation b, Recipe c
where a.MealTypeID=1 and a.RecipeID=b.RecipeID and a.RecipeID=c.id
umm help
I've got a problem, I need a SQL query that I can't get my head around can anybody help??
I have 5 tables
Recipes - id, name
FoodType - id, name
MealType - id, name
RecipeFoodRelation - recipe id and foodtype id
RecipeMealRelation - recipe id and Mealtype id
I want to be able to list the Recipe ids, its name and it's food type for a particlue meal type.
I've tried various methods but I keep getting some duplicate records.
The nearest I've got is something like this
select a.RecipeID, c.Name, b.FoodTypeID
from RecipeMealRelation a, FoodRecipeRelation b, Recipe c
where a.MealTypeID=1 and a.RecipeID=b.RecipeID and a.RecipeID=c.id
umm help