Forums

This topic is locked

sql statement

Posted 27 Nov 2005 13:59:28
1
has voted
27 Nov 2005 13:59:28 fuku kawakami posted:
i am making a dynamic site. In an html page i have 2 text fields that the user can enter 2 ingredients and by pressing a button named search a recordset is running that looks for a recipe that contains this 2 ingredients. The problem is that the recipe_name field is in a table named recipe_desc the ingredient_name is in a table calles ingredient_desc and the combination of the two is in a third table named recipe_ingredient_table where the recipe_id matches with ingredient_id. I try to make a query using subqueries but because i have two joins since the tables are three the statement doesn't work i tried this query :

select recipe_name
from recipe_desc r, ingredient_desc i, recipe_ingredient_table t
where recipe_ingredient like '%var1% and
(select recipe_name from recipe_desc r, ingredient_desc i, recipe_ingredient_table t
where recipe_ingredient like '%var2%' and (r.recipe_id = t.recipe_id and i.ingredient_id=t.ingredient_id)).

but neither this works! i believe that my thought is almost right but i am loosing a detail with the query that i cannot find! i have tested at least ten different version but none of them works <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
please somebody help me! beacause in few days i have to submit my project <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

Reply to this topic