Searching for a recipe string with multiple ingredients

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Searching for a recipe string with multiple ingredients

Flakheart
This post has NOT been accepted by the mailing list yet.
With this query, I wanted to search for a 'near' recipe title where the recipe 'sounds like' turkey and has both salt and sugar in the ingredients.

SELECT m.*, n.Ingredient
FROM Recipes AS m, Ingredients AS n
WHERE n.Recordid = m.Recordid    
AND m.Recipetitle LIKE '%turkey%'
AND n.Ingredient LIKE '%salt%'
AND n.Ingredient LIKE '%sugar%'


if I do this, I get no recipes and I do have both items in the recipe ingredients, I have checked.

AND n.Ingredient LIKE '%salt%'
AND n.Ingredient LIKE '%sugar%'

If I do this, the query works, gets one item for each ingredient match but I need both.

AND n.Ingredient LIKE '%salt%'
OR n.Ingredient LIKE '%sugar%'

How do I modify this query to return recipes where both ingredients are present (and even more if I need it)?