功能:d表有属性(d_id,s_num,sum),yao表有属性(id,price,count)(注:d_id跟ID一样)当我向d表添加:insert into d(s_id,num) values ( '01',6)时,更改yao表中count=count-5,d表的s_sum=price*num,我的代码为:delimiter $create trigger tg1 after insert on d for each row beginupdate yao,d set count=count-new.num,d_sum=new.num*sprice where id=new.d_id;end$delimiter;结果显示:Can't update table 'd' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.求大神帮我写个,或者改下
添加回答
举报
0/150
提交
取消