What I am trying to accomplish is this: I have table1 which contains user_id,group_id(int with a default value set) and expire_date.Also table2 which between others has a field user_group_id which serves as foreign key to group_id of table1.
When the date is reached I'd like to change values of group_id and user_group_id to default.
Unfortunately it seems I can't figure my way around this since I'm really new to mysql.
Table1 will contain like 500 rows max.Probably the event won't be used to update more than 4-5 rows per run.
Automated alternative solutions are welcome. mysql 5.2.7 php 5.3.8 CentOs 6
Thanks in advance for any responces!
Did it with event.
CREATE EVENT event_name2
ON SCHEDULE
EVERY 24 HOUR
DO
UPDATE test.employees
SET `group`=DEFAULT
WHERE expire_date <= now( )
Firstly i thought to use triggers but they occur only when something is changed on database witch wasnt the case here.