UPDATE repository_quests
SET status_game_quests = 1, status_progress_registration_quests = 0,
salt_quests = (SELECT MAX(salt_quests) + 1 FROM repository_quests)
WHERE status_accessibility_quests = 1
AND status_active_quests = 1
AND status_game_quests = 0
AND status_progress_registration_quests = 1
AND NOW() >= registration_date_quests;
@salt_quest = SELECT MAX(salt_quests) + 1 FROM repository_quests;
UPDATE repository_quests SET status_game_quests = 1, status_progress_registration_quests = 0, salt_quests = @salt_quest
WHERE status_accessibility_quests = 1
AND status_active_quests = 1
AND status_game_quests = 0
AND status_progress_registration_quests = 1
AND NOW() >= registration_date_quests;
Чуть модернизировал код:
SET @salt_quest = (SELECT MAX(salt_quests) FROM repository_quests);
UPDATE repository_quests SET status_game_quests = 1, status_progress_registration_quests = 0, salt_quests = @salt_quest:= @salt_quest + 1
WHERE status_accessibility_quests = 1
AND status_active_quests = 1
AND status_game_quests = 0
AND status_progress_registration_quests = 1
AND NOW() >= registration_date_quests;