简体   繁体   中英

how can check on records in MySQL db every minute automatically..?

I need some think like trigger in MySQL db to check records every minute
Example: i have table 'A' in my db and i want to change the active Column for the record form 1 to 0 when my current date became greater than end date ...

How can I do that automatically using MySQL db ?
DESC 'A' :

name      : string
startDate : DateTime
endDate   : DateTime
active    : bool

Delete your ' ACTIVE ' field, it is a computed one
and use this sql query :

SELECT NAME, STARTDATE, ENDDATE, IF(ENDDATE < CURDATE(), 0, 1) AS ACTIVE FROM A

创建一个数据库作业并设置一分钟的间隔。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM