MySQL syntax error
#1

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.

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
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.

Код:
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
Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)