user4846835
user4846835

Reputation:

How to make MySQL automatically update value?

Hello,
Is it possible to tell MySQL to automatically update value of a given cell in a given interval of time?

E.g. I want to make MySQL update the value of a coloumn named "status" to "OFF" in every 60 seconds no matter what the original value is. This should happen automatically.

If possible, then how? Otherwise is there any other technique to do the same?

Upvotes: 2

Views: 79

Answers (1)

Dheeraj
Dheeraj

Reputation: 35

I Think you should create the event

CREATE EVENT STATUSOFF ON SCHEDULE EVERY 1 MINUTE DO update TABLE_NAME set status_off='OFF' ;

For more detail http://dev.mysql.com/doc/refman/5.1/en/create-event.html

Upvotes: 1

Related Questions