我在mysql数据库中有一个表格,我根据利息+借入的数量来计算New Owed Balcance ...我希望它是当利息被改变时新欠的balace改变我使用触发器但它确实当兴趣改变时似乎没有更新它
DELIMITER |
CREATE TRIGGER updateloan BEFORE INSERT ON loan
FOR EACH ROW BEGIN
SET NEW.app_amnt_owed = NEW.app_intrst +NEW. app_ln_amnt;
END;
|
答案 0 :(得分:1)
CREATE TRIGGER updateloan_update
BEFORE UPDATE ON loan
FOR EACH ROW
SET NEW.app_amnt_owed = NEW.app_intrst + NEW.app_ln_amnt;