I have an event in my mysql database called "updategold", what it should do is increase a table value by 5 every second. It doesn't work, though. No error messages, everything looks ok but it is just not running. Here's how it is set up:
Definition (supposed to run this every second):
update stats.gold set stats.gold = stats.gold + 5
where stats.id = users.id
Definer: root@localhost
Any ideas?
EDIT
Entire process
DROP EVENT `updategold`; CREATE DEFINER=`root`@`localhost` EVENT `updategold` ON SCHEDULE EVERY 1 SECOND STARTS '2014-10-19 11:37:00.000000' ON COMPLETION NOT PRESERVE ENABLE DO update stats set stats.gold = stats.gold + 5 where stats.id = users.id
Your syntax is wrong in update stats.gold, you should only give the table_name
update stats.gold set stats.gold = stats.gold + 5
where stats.id = users.id
should be:
UPDATE stats SET stats.gold = stats.gold + 5
INNER JOIN users
ON stats.id = users.id
and added a JOIN
to select the users to be updated from the users table.
Maybe it's your syntax. Have you done it like this?
UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;