且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL触发器-使用从另一个表中选择的值更新表

更新时间:2022-12-10 16:55:43

这是复合触发事件(INSERT or UPDATE)上的语法错误.试试:

This is a syntax error on the compound trigger event (INSERT or UPDATE). Try:

CREATE TRIGGER update_user_last_login
    AFTER UPDATE ON last FOR EACH ROW ...

我不认为 mysql在同一触发器中支持复合事件.您可以创建两个触发器,一个用于插入后,另一个用于更新后.这两个触发器可以重复调用相同的代码,也可以调用通用的存储过程.

I don't think mysql supports compound events in the same trigger. You could create two triggers, one for after insert and one for after update. Those two triggers can call the same code in duplicate or call a common stored procedure.