I have the following trigger:
CREATE TRIGGER sum AFTER INSERT ON news FOR EACH ROW UPDATE news SET NEW.sum = (NEW.int_views + NEW.ext_views)/NEW.pageviews
It summarizes the column int_views and ext_views table and divides them into total pageviews.
Whenever I try to add a new line to the news, I get the following error:
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.
The trigger seems pretty simple to me. Is there a reason why the trigger does not start?
source share