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
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