I\'m really bad at SQL, but I\'m trying to keep my database simple and minimalistic as possible. Not duplicating values but using references and id\'s instead.
Now after
It won't allow you to update the table because it's already being read by the INSERT INTO.. SELECT
query that invokes this trigger.
An alternative way would be to disable the trigger and update the users table separately, e.g.:
INSERT INTO signed (time_of_start, player)
SELECT time_of_game_id, users.user_id FROM time_of_game, users
WHERE time_of_game.time_of_start="2017-02-01 12:00:00"
AND users.steamid="1234567890123456";
UPDATE users join time_of_game SET users.credit = users.credit-1
where time_of_game.time_of_start="2017-02-01 12:00:00"
AND users.steamid="1234567890123456";
You can add a join column with ON
clause if there is any column that links these two tables.