如何使这个sqlite触发器与MYSQL兼容,我从来没有使用MYSQL触发器,我很困惑。
CREATE TRIGGER IF NOT EXISTS update_this AFTER INSERT ON this
BEGIN
UPDATE `another` SET `something` = `something` + new.number;
END;
解决方案:
delimiter |
CREATE TRIGGER update_this AFTER INSERT ON this`
FOR EACH ROW BEGIN
UPDATE `another` SET `something` = `something` + NEW.something WHERE `id`= NEW.id;
END;
|
delimiter ;
答案 0 :(得分:1)
未验证:
delimiter //
CREATE TRIGGER update_this AFTER INSERT ON your_table
BEGIN
UPDATE `another` SET `something` = `something` + new.number;
END;
//