mysql - Trigger update on another table after insert -
i want field current_price in table stock updated when insert new table stock_changes.
so stock.current_price should updated stock_changes.current_price
i have tried triggers wont work.
create trigger update_stock after insert on stock_changes each row update stock set current_price =new.current_price id = new.stock_id;
you need use delimiter
.
try :
delimiter $$ create trigger update_stock after insert on stock_changes each row begin update stock set current_price =new.current_price id = new.stock_id; end; $$ delimiter ;
Comments
Post a Comment