0
變化值。如果名字或姓氏得到改變我希望數據庫自動改變全名太我有一個表像這樣的MySQL:觸發器 - 針對不同的列
id firstname lastname fullname
1 alex car alex car
2 tony table tony table
。
我這個觸發
CREATE TRIGGER mytrigger
AFTER UPDATE
ON mytable FOR EACH ROW
BEGIN
UPDATE `mydb`.`mytable` SET `fullname` = CONCAT(NEW.firstname, " ",NEW.lastname)
END;
嘗試過,但我得到這個錯誤:
#1442 - Can't update table 'mytable' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
謝謝你。更新觸發前
我用BEFORE觸發器試過了,但沒有奏效。 – coder
@coder。 。 。它是如何工作的? –