0
I want to create a trigger wich will be executed when a new row is about to be
inserted if my condition is satified (latest version = 1) all privious row will
be updated with latest version = 0
CREATE TRIGGER remiseazero
BEFORE INSERT
ON wp_stattype2_3_activite
FOR EACH ROW
BEGIN
IF NEW.latestversion = 1
THEN
update wp_stattype2_3_activite
set latestversion = 0 where typecas = new.typecas;
END IF;
END;$$
#1064 - 您的SQL語法錯誤;檢查與您的MySQL服務器版本對應的手冊,以便在第9行的''附近使用正確的語法。
你是如何創建觸發器的?通過phpMyAdmin?如果是這樣,你有沒有向phpMyAdmin表明$$應該是你的分隔符? –