1
如何讓這個sqlite觸發器與MYSQL兼容,我從來沒有使用MYSQL的觸發器,我很困惑。使MYSQL的SQLITE觸發器工作
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 ;
CREATE TRIGGER語法 - http://dev.mysql.com/doc/refman/5.5/en/create-trigger。 html – Devart 2012-02-16 08:29:57