mardi 17 février 2015

SQLITE Query from two different tables

I have two tables in my database, Recipes Table and Ingredients Table.


The database looks like this:



Recipes Table:
recipe_id
recipe_name

Ingredients Table:
ingredient_id
recipe_id
ingredient_name


These tables are connected by recipe_id.


The function I'm developing allows the user to select up to four ingredients and all the recipes that contain those ingredients will be displayed.


The query I want to make goes like:



Get all the recipes that contain ingredients LIKE pork, pepper, tomato, salt.


Based on the tables above, how can I do this?


Aucun commentaire:

Enregistrer un commentaire