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

Val*_*rie 10 mysql null replace phpmyadmin

我在互联网上看了我的答案,也许我只是做错了.我的MySQL表中有一列我需要使用phpMyAdmin在SQL查询中用文本字符串替换所有NULL值.我不希望输出以这种方式出现,我想实际用文本字符串替换空值.

我试过了

UPDATE `tablename` SET fieldname = replace (fieldname, "", "textstring")
Run Code Online (Sandbox Code Playgroud)

我已经读过了

SELECT ISNULL(field,"replacetext)
Run Code Online (Sandbox Code Playgroud)

但这仅显示输出,但实际上并未在表中替换它.

我无法理解这一点,我浪费了太多时间来寻找答案.

Nyl*_*ile 24

update tablename set fieldname = "textstring" where fieldname is null;
Run Code Online (Sandbox Code Playgroud)


Raj*_*Raj 5

你有没有尝试过

UPDATE `tablename` SET fieldname = '' where fieldname is null
Run Code Online (Sandbox Code Playgroud)