1.在查询中执行,一种类型(插入、更新、删除)的触发器只可以创建一个
CREATE TRIGGER `insert_value_new` AFTER INSERT ON smd_value FOR EACH ROW
BEGIN
DELETE
FROM
smd_value_new
WHERE
new.add_code = smd_value_new.add_code;
INSERT INTO smd_value_new(
x,
save_time,
add_code,
cstype,
y,
z,
createtime
)
VALUES
(
new.x,
new.save_time,
new.add_code,
new.cstype,
new.y,
new.z,
new.createtime
);
END;