如何替换特定表中特定字段中的所有NULL值?

问题描述:

我已经在网上查找了我的答案,也许我只是在做错事。我在我的MySQL表中有一列,我需要用我的SQL查询中的文本字符串替换所有NULL值使用phpMyAdmin。我不希望输出出现这种方式,我想实际上用文本字符串替换空值。如何替换特定表中特定字段中的所有NULL值?

我已经试过

UPDATE `tablename` SET fieldname = replace (fieldname, "", "textstring") 

我已经阅读了关于

SELECT ISNULL(field,"replacetext) 

但这仅显示输出,但在表中实际上并没有取代它。

我无法弄清楚,我浪费了很多时间试图找到答案。

update tablename set fieldname = "textstring" where fieldname is null; 
+0

打我吧:)删除我的答案。 – kander 2011-01-07 19:05:06

+0

我需要200才能获得更少的广告(: – 2011-01-07 19:10:49

你试过

UPDATE `tablename` SET fieldname = '' where fieldname is null