| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
sql help -how to join 3 tables?
helooo...
i have 3 tables -Recipes, Ingredients and Products. Recipes table: RecipeID -PK Ingredients table: IngredientID -PK IngreRecipeID -Foreign key to Recipes table IngreProductID -Foreign key to Products table Table: ProductID -PK how do i join them into 1 recordset? |
|
#2
|
|||
|
|||
|
Just specify the fields you want from each table and join the ids:
Code:
select
r.recipe_name,
i.ingredients_list,
p.products_list
from
recipes r,
ingredients i,
products p
where
r.RecipeID = i.IngreRecipeID and
i.IngreProductID = p.ProductID
;
|
![]() |
| Viewing: Tutorialized Forums > Databases > SQL Basics > sql help -how to join 3 tables? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|