I have a table called Consumption, in this table I have a Quantity column. I have another table called Product, in this table I have an Inventory column.
Whenever a new consumption is entered, one must choose a product and the quantity that was consumed of that product.
I need to make a trigger where every consumption consumed decreases the stock of the chosen product according to the amount reported. Example: Product 1 has 10 in stock. Product Consumption 1, 2 quantities. Update product stock 1 to 8.
I did not reach the conclusion of any code. Thank you.