Results 1 to 4 of 4
Oct 23, 2009, 16:50 #1
- Join Date
- Sep 2004
- 0 Post(s)
- 0 Thread(s)
MySQL Triggers - Avoiding FOR EACH ROW
Is is possible, when using MySQL triggers, to avoid having an operation occur for every row that has been affected by the operation.
CREATE TRIGGER students_create AFTER INSERT ON students FOR EACH ROW UPDATE stats SET total = (SELECT count(*) FROM students)
I could use a total = total + 1 update, but that would consist of 99 useless queries.
Any ideas to avoid using "FOR EACH ROW"? When I try to remove it from the creation query the MySQL client throws an error. Also in the mysql documentation it looks as if it ALWAYS has to be included.
Any ideas?I can't believe I ate the whole thing