我正在尝试在 mysql 触发器中执行以下语句(通过 phpmyadmin)
FOR EACH ROW BEGIN
DELETE from balancetable WHERE triggeredby="salesinvoices" AND invoiceNumber=NEW.invoiceNumber;
INSERT INTO balancetable SET invoiceNumber=NEW.invoiceNumber,ledgerId=NEW.buyerId,date=NEW.invoiceDate,company=NEW.companyId,type="debit",triggeredby="salesinvoices";
END;
我收到此错误:
MySQL said: #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 'FOR EACH ROW BEGIN DELETE from balancetable WHERE triggeredby="salesinvoices" A' at line 1
从上一小时开始,我一直在努力解决这个问题。请指出我的愚蠢:)