Skip to content
Advertisement

SQL multiple values in Where = ā€œNā€

I am going to execute SQL command on my multiplayer game, I don’t wanna any game stop or something like that because I am going to lose players so everything must go smooth.

Its my command :

UPDATE `players`
   SET `mana` = `mana` + 500 WHERE `vocation` != "121;122;123;124;125;126" 
   AND `id` IN (SELECT `player_id` FROM `player_storage` WHERE `key` = 25128 AND `value` = 15 GROUP BY `player_id`);

I want to update every vocation that is not 121 OR 122 OR 123 OR 124 OR 125 OR 126

Advertisement

Answer

You can use NOT IN to filter values that are not in a list.

WHERE vocation NOT IN (121, 122, 123, 124, 125, 126)
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement