我有以下触发器:
CREATE TRIGGER sum
AFTER INSERT
ON news
FOR EACH ROW
UPDATE news SET NEW.sum = (NEW.int_views + NEW.ext_views)/NEW.pageviews
int_views
它将表格的和列相加,ext_views
然后将它们除以总浏览量。
每当我尝试向新闻添加新行时,都会收到以下错误:
ERROR 1442 (HY000) at line 3: Can't update table 'news' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
触发器对我来说似乎很简单。触发器无法运行是否有原因?