我正在尝试创建一个触发器来更改尾列的值(如果为空)。
我知道另一个语法错误与freshman,这是一件很奇怪的事情。
你可以开始阅读她的代码:
#1064-Erreur de syntaxe pr:ésde'select i.id from categorie cat,souscategorie scat,item i,panier p where p.idite=':la ligne 3。
delimiter /
create trigger voiddresstaille before insert on panier for each row
begin
if new.idite=(select i.id from categorie cat,souscategorie scat,item i,panier p where p.idite=i.id and i.idscat=scat.id and scat.idcat=cat.id and cat.nom='Vêtements & Chaussures') then
if new.taille='' || new.taille=NULL then
new.taille='M';
end if;
end if;
end /
如果你不知道答案,请投票支持我。 谢谢。
你的sytnax错了。
我将您的查询更改为正确的内部联接
您只能有一个I.ID从您的选择,否则将以错误结束
DROP TRIGGER IF EXISTS voiddresstaille ;
delimiter //
create trigger voiddresstaille before insert on panier for each row
begin
if new.idite = (select i.id
from categorie cat
INNER JOIN souscategorie scat ON scat.idcat=cat.id
INNER JOIN item i ON i.idscat=scat.id
INNER JOIN panier p ON p.idite=i.id
where cat.nom='Vêtements & Chaussures') then
if new.taille='' OR new.taille IS NULL then
SET new.taille='M';
end if;
end if;
end //
DELIMITER ;