MySQL Trigger to Update Status Field Based on Time
This trigger is created in MySQL and it is triggered after an update on the ///'platform/_ukey///' table. It checks if the ///'status///' field is equal to 4. If it is, it gets the current date and time and sets it to the variable ///'@current/_datetime///'. Then, it gets the current date and sets it to the variable ///'@current/_date///'. After that, it calculates the date and time of the next day at 1 AM and sets it to the variable ///'@next/_day/_datetime///'. //n//nThe trigger then checks if the current date and time is greater than or equal to the next day at 1 AM. If it is, it updates the ///'status///' field to 0 for the row with the same ID as the updated row in the ///'your/_table///' table.//n//nNote that you need to replace ///'your/_table///' with the actual table name you want to update.
原文地址: https://www.cveoy.top/t/topic/p2zo 著作权归作者所有。请勿转载和采集!