3
我在這裏犯了什麼錯誤?觸發器 - 語法錯誤#1064新舊
CREATE TRIGGER total BEFORE UPDATE ON `current` FOR EACH ROW
BEGIN
if new.`new_pay_date` <> old.`new_pay_date`
SET new.`total_cash` = new.`curr_cash` + new.`total_cash`;
end if;
END;
$$
錯誤:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET new.`total_cash` = new.`curr_cash` + new.`total_cash`; end if;' at line 4
這是工作不
if new.`new_pay_date` <> old.`new_pay_date`
end if;
但我需要檢查這一點,只有日期更改更新。
當前表:
curr_cash
new_pay_date
id_person
id_thing
total_cash
任何人都可以幫助我嗎?
又見http://dev.mysql.com/doc/refman/5.5/en/if.html參考 – Spontifixus