MySQL Trigger for Aging
I'm trying to create a trigger that will automatically increase the year
column by 1 when the month column is 12, and then empty the month column.
But I don't understand triggers that well and I'm confusing myself in my
attempts, so I was hoping someone could look over this code to see if it
would work or suggest improvements:
CREATE TRIGGER aging BEFORE UPDATE ON dogs
FOR EACH ROW
DELETE FROM dogs WHERE month = 12;
UPDATE year SET year = year+1;
Thanks!
No comments:
Post a Comment