17.12.2015, 15:09
I have never liked using if statements in mysql queries but to let myself avoid formatting query couple of times in a code with default PAWN if statements I wanted to move into into one MySQL query.
I am having an MySQL Syntax Error, and I really don't know how to fix it up. It's probably related to "THEN IF", I guess.
Thanks.
pawn Код:
UPDATE `items_data` IF((`model` >= 15077 AND `model` <= 15084) THEN IF((`quantity` + %d) > 3) SET `quantity` = 3) ELSE SET `quantity` = `quantity` + %d WHERE `model` = %d AND `owner_uid` = %d
Код:
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 'IF((`model` >= 15077 AND `model` <= 15084) THEN IF(`quantity` + 3 > 3) SET `quan' at line 1