mysql - resetting column values after time -
i new phpmyadmin , sql databases.
i know how can add "script" resets value in columns of table after time period -> want column set int value 0 every 72hours every row. possible , how?
what want called "event". here's potential definition; needs may vary.
create event `zero_my_column` on schedule every 72 hour starts '2015-07-13 00:00:00' on completion preserve enable begin update mytable set counter = 0 counter <> 0; end
there's configuration work do ensure mysql server run event correctly.
this actual update query.
update mytable set counter = 0 counter <> 0;
notice where
clause. prevents redundant updating of rows have 0 column value counter.
Comments
Post a Comment