I'm working with mySQL on a project for restaurant. I have two tables one is named "DISH" and the other is "INGREDIENTS",As you know a dish is composed of several ingredients.
What I want to do is organize the orders of all the customers and number the dishes that were ordered and therefore know the amount of ingredients that are needed to prepare that dish after that i need to substract from the storage in this case "INGREDIENTS" table the amount of ingredients that were used.
to my mind only come this:
UPDATE INGREDIENTS SET stock= stock-ingredients_used WHERE [i don't know what to write here]
How could i do at the moment of increase the amout of dishes in the table DISH substract from the stock column at the INGREDIENTS table the ingredients used in that dish ?