同一个数据库下的gorder表与goods表,我想给gorder表中的字段Money自动触发插入数据为goods表中的Price与gorder表Cust_Count的乘积
代码如下
CREATE TRIGGER tri_1 AFTER UPDATE ON gorder FOR EACH ROW BEGIN
IF (gorder.Cust_Count!=NULL)AND(gorder.Cust_Count!=0)
THEN
UPDATE gorder
SET gorder.Money=goods.Price*gorder.Cust_Count
WHERE (id=gorder.Money) AND (goods.Gid=gorder.Gid);
ELSE SELECT E001 INTO gorder;
ELSE IF;
END;
错误提示如下
Query : CREATE TRIGGER tri_1 AFTER Update ON gorder FOR EACH ROW BEGIN if (gorder.Cust_Count!=null)and(gorder.Cust_Count!=0) then update...
Error Code : 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 '' at line 6
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000
Query : else SELECT E001 INTO gorder
Error Code : 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 'else SELECT E001 INTO gorder' at line 1
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000
Query : else if
Error Code : 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 'else if' at line 1
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000
Query : END
Error Code : 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 'END' at line 1
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000
求助!!!