Reputation: 379
Which value to set to 'default' if I want to keep the test ?
mysql> update softwareitem set SIMobsolescence = DEFAULT where SIMID =
2624553;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> update softwareitem set SIMobsolescence = if (1>2, 0, DEFAULT)
where SIMID = 2624553;
ERROR 1064 (42000): 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 ') where SIMID = 2624553' at line 1
mysql> update softwareitem set SIMobsolescence = if (1>2, 0, 'DEFAULT') where SIMID = 2624553;
ERROR 1366 (HY000): Incorrect integer value: 'DEFAULT' for column 'SIMobsolescence' at row 1
mysql>
Upvotes: 1
Views: 68
Reputation:
So - to make it more readable - the answer is to use the DEFAULT(col) function:
mysql> update softwareitem set SIMobsolescence = if (1>2, 0, DEFAULT(SIMobsolescence))
where SIMID = 2624553;
Query OK, 1 row affected (0.01 sec)
Upvotes: 1