Problem with trigger
Posted on 2011-02-17
I am using mysql 5.1
I have two tables that I am working with. I have a product table and a discount table.
When a product gets added, I use an after insert trigger to create a record in the discount table. Here is the trigger. I am using navicat to create the trigger and this is how it displays. It is firing After>Insert
insert into discount (product_id,amount,is_percent) values (New.product_id,New.product_price-New.discount_price,0);
This trigger works great. What I have to do after this is update the product table with a value from the newly added record in the discount table. Here is that trigger. This fires After>Insert and is where I receive an error. This trigger is in my discount table.
update product SET product_discount_id = NEW.discount_id where product_id = NEW.product_id
Should this work?