Is there any way to do an update in the same table, in another line, by after insert
or before insert
?
Is there any way to do an update in the same table, in another line, by after insert
or before insert
?
According to this Stackoverflow response , what you want is not possible in MySql. Excerpt from documentation :
A stored function or trigger can not modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger.
A suggested alternative in the same answer is to create a stored procedure
that does the action of trigger
plus update
next to a transaction
.