开发者

How do I replace all my NULL values in a particular field in a particular table?

I've looked all over the internet for my answer, and perhaps I'm just doing things wrong. I have a column in my MySQL table that I need to replace all the NULL values with a text string in my SQL Query using phpMyAdmin. I don't want the output to come out that way, I want to actually replace the null values with the text string.

I've tried

UPDATE `tablename` SET fieldname开发者_运维问答 = replace (fieldname, "", "textstring")

I've read up on

SELECT ISNULL(field,"replacetext)

But this only shows the output, but doesn't actually replace it in the table.

I can't figure this out, and I've wasted so much time trying to find an answer.


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


Have you tried

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜