Quote:
Originally Posted by Muiter
Can I use an IF in my UPDATE statement?[/I]
|
of course you can, but not like that
syntax:
Code:
UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...
[WHERE where_condition] ...
you are allowed to SET multiple column values, but it must always be a
column name on the left side of the equation
i.e. you cannot put the IF on the left side