I’m trying to build a scheduled query but something is triggering an error, and it’s not clear what’s wrong. Event scheduling is a bit new to me but I have plenty others working, so there’s some piece of information I’m missing:
DELIMITER //
CREATE EVENT gen_firstJoins
ON SCHEDULE EVERY 1 HOUR
ON COMPLETION PRESERVE
DO BEGIN
CREATE TEMPORARY TABLE tmp_joins SELECT username, MIN(player_join) AS player_join FROM joins GROUP BY username ORDER BY player_join ASC ;
TRUNCATE joins_first;
INSERT INTO joins_first (username, player_join) SELECT username, player_join FROM tmp_joins GROUP BY username ORDER BY player_join;
END//
DELIMITER ;
Error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ame, MIN(player_join) AS player_join FROM joins GROUP BY username ORDER BY playe’ at line 6
Answered in comments, so reposting comment as answer Re: https://meta.stackexchange.com/questions/90263/unanswered-question-answered-in-comments
You may have a hidden character / line feed etc?
Just select and delete the entire work “username” (after the SELECT) and try retyping.