MYSQL - 更新单个列中的所有空字段

Cyb*_*ell 0 mysql phpmyadmin

使用PhpMyQdmin,如何更新单个列中的所有空字段.我尝试了一些我在网上找到的命令,但似乎都没有.

表称为"新闻",列称为"profile_4",类型为"varchar(255)"

我试过这个:

UPDATE news SET profile_4 = 'General' WHERE profile_4 = NULL 
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

我需要的是用'General'更新空列字段

谢谢克里斯

rko*_*egi 8

试试这个 :

UPDATE news SET profile_4 = 'General' WHERE profile_4 IS NULL OR profile_4 = ''
Run Code Online (Sandbox Code Playgroud)

有关完整参考,请参阅http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html

您不能使用算术比较运算符(如=,<或<>)来测试NULL.