我在mysql中创建触发器,但我在其中遇到错误。
我想要做的是当状态更新并设置为1时我必须检查买家是否也处于活动状态然后我必须更新状态。
DELIMITER //
CREATE TRIGGER `after_vendor_update` AFTER DELETE ON `data_vendor`
FOR EACH ROW BEGIN
IF(NEW.vendor_status = 1)
UPDATE vendor_setting SET `buyer_setting_status` = NEW.vendor_status WHERE buyerid IN (SELECT bid FROM data_buyer WHERE buyer_status='1');
ELSE
UPDATE vendor_setting SET `buyer_setting_status` = NEW.vendor_status;
END IF;
END
//
DELIMITER ;
答案 0 :(得分:2)
您的if
语句语法错误,应该是:
IF NEW.vendor_status = 1 THEN