I have 3 table in database:
product
CREATE TABLE `product` ( `product_id` int(11) NOT NULL, `product_name` varchar(50) NOT NULL, `product_stock` int(11) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1;transaction
CREATE TABLE `transaction` ( `transaction_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `transaction_date` datetime NOT NULL, `transaction_status` ENUM('pending','process','cancel') NOT NULL DEFAULT 'pending' ) ENGINE=InnoDB DEFAULT CHARSET=latin1;transaction_details
CREATE TABLE `transaction_details` ( `transaction_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `qty` int(11) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
if transaction_status in transaction table changed to "cancel" how to update product_stock in product table based on qty in transaction_details table using trigger