sql语句 update字段null不能用is null

update字段为 null 值时,
要用 
set column = null,
而不是
set column is null


UPDATE tableA set 字段a is null WHERE字段b = 条件; 
例 

mysql> UPDATE t SET col3 is null WHERE col1 = 'a';
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 'is null WHERE col1 = 'a'' at line 1

 

UPDATE tableA set 字段a = null WHERE字段b = 条件;

mysql> UPDATE t SET col3 =  null WHERE col1 = 'a';
Query OK, 1 row affected (0.03 sec)

 

以上。

你可能感兴趣的:(mysql)