每个人。我想在插入记录后计算 A(表)中的 id 计数,我的 sql 出现故障:
CREATE TRIGGER check_data_count
AFTER
INSERT
ON A
FOR EACH ROW
BEGIN
SELECT @data_count:=COUNT(*) FROM A WHERE id = NEW.id;
END;
如我们所见,我犯了一些错误(^_^)。
我的 mysql 版本信息:Ver 14.14 Ditrib 5.5.9,适用于 Win64(X86)。错误消息是:
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 8
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
最后,谢谢大家。