Scheduled update queries

I searched on this and didn’t run into anything so if someone could point me in the right direction I would appreciate it.

I want to run an update every night just after midnight (server time) to update the status of records in a table that are expired based on an expired date carried in the table. I can write the syntax of the query just fine but I don’t know how to make it fire on a schedule.

Thanks

maybe it’s me, but this seems like overkill

:smiley:

Maybe so. I have 4 types of active statuses and two types of expired statuses, so it’s a little more than just the expired date. In other words, I’m not just setting the status to active if it’s before the date and expired if it’s after the date. It will be set to one if there is certain activity and another if there is not.

I suppose I could do that logic every time I use this info but it seems a lot easier to do it once and then when I am processing the data later it is much easier. For example, when I retrieve the data, I want to sort it by the different statuses. If I have to do that logic, it seems much more complex to me, if it is even possible.

Bad idea? :slight_smile:

For running scripts on a schedule in Linux you have cron jobs and in windows you have task scheduler

Thanks for the input.

I haven’t used them yet but mysql events introduced in mysql 5.1 should be just want you are looking for.

That looks like what I am looking for. I will read up on it and give it a try. They do mention that it is similar to cron jobs and task scheduler which was previously mentioned. Does anyone have any practical experience as to which is better assuming one is.