Skip to content
Advertisement

What is wrong with this syntax that works in mysql 5 but doesn’t work in mysql 8

1064 error in SQL Syntax near ‘!=guildRank LIMIT 1 END’ at line 3

CREATE DEFINER=`root`@`localhost` PROCEDURE `DeleteUserGuildAttr`(IN userId INT unsigned, IN guildId 
INT unsigned, IN guildRank SMALLINT unsigned)
BEGIN
     DELETE FROM guildattr WHERE id=userId AND guild_id=guildId AND rank!=guildRank LIMIT 1;
END

Advertisement

Answer

MySQL 8.0 added the rank() window function, so it is now reserved.

You need to escape it:

`rank` <> guildRank

for the condition.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement