Update column of a table when deleting records from 2 other tables

I have a query as I would in the following: I have 3 tables, a Sales table,
another sales_detail and finally table_inventories, the sales table is related to the sales_detail by the id sales,
and the sales_details is related to inventories by the product field.

I have created an action (updatestock) that when I make a change in the table (detail_sales) takes the quantity
of the product from the detail_sale table and updates the stock of that product in the inventory table. so far so good...

Now, when I delete a sale, it deletes all the products sold from the Sale_detail table because of the relationship
they have, but what I need is that it also update the stock of the inventory table because when I delete the sale,
the stock of all those products returns to the state as they were before the sale.....hopefully you can help me

 

0 9 637
9 REPLIES 9
Top Labels in this Space