MYSQL触发器问题-非常简单
DELIMITER $$
CREATE TRIGGER stock_empty AFTER UPDATE on products
FOR EACH ROW
DELETE FROM products WHERE stock <=0;
END$$
我试图让我的产品表在每个 UPDATE 语句后进行自我检查,并删除库存数为 0 或负数的行。我可以做到这一点,但它不起作用。
感谢您的帮助
DELIMITER $
CREATE TRIGGER stock_empty AFTER UPDATE on products
FOR EACH ROW
DELETE FROM products WHERE stock <=0;
END$
I am trying to make my products table check itself after every UPDATE statement and delete rows that have 0 or negative stock counts. I could manage to get this far, but it is not working.
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这么简单,你为什么不自己解决呢?
[编辑]
这就是正确的语法应该是什么样子,但是还有一件事:
来自: http://dev.mysql.com/doc /refman/5.5/en/stored-program-restrictions.html
If it's that easy, how come you didn't solve it yourself?
[edit]
That's how correct syntax should look like, however there's one more thing:
From: http://dev.mysql.com/doc/refman/5.5/en/stored-program-restrictions.html