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
Create a Database job and set the interval of one minute.