触发器 - 错误#1442无法更新[MYSQL]

时间:2012-12-03 23:00:18

标签: mysql syntax triggers mysql-error-1442

  

可能重复:
  MySQL triggers cannot update rows in same table the trigger is assigned to. Suggested workaround?

我对此触发器有一些问题:

create trigger pay_out before insert on `payment_out`
for each row
then
UPDATE `payment_out` o
INNER JOIN payment p ON p.id_1 = o.id_1 AND o.id2 = p.id2
SET o.`how_much_to_pay` = p.cash / p.months;
end;
$$
table payment_out
id1
id2
how_much_to_pay

table payment
id1
id2
cash
months

ERROR:

  

1442 - 无法更新存储函数/触发器中的表payment_out,因为它已被调用此存储函数/触发器的语句使用。

当我制作类似“new.o.how_much_to_pay”的内容时,它说它没有看到名为new.o.how_much_to_pay的列。有什么想法吗?

0 个答案:

没有答案
相关问题