I'm using MariaDB 10.4.18, I'm trying to check if a certain value in a specific column already exists; example of the table:
Name | Money | Weapons | Skin |
---|---|---|---|
First | first_value | first_value | first_value |
Second | second_value | second_value | second_value |
I would like to check if the value "First" in the column "Name" already exists, if true do nothing else creates the values.
I'm using as documentation this
IF NOT (SELECT * FROM players WHERE Name = '${player.name}')
THEN
INSERT INTO players (Name, Money, Weapons, Skin) VALUES ('${player.name}',100,'weapon_pistol,weapon_pistol_mk2', 'player_zero')
END IF;
The error is:
(node:10596) UnhandledPromiseRejectionWarning: Error: (conn=212, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'END IF'
Thank you for your help.