简体   繁体   English

如何删除随机顺序的字符串中的特定数字?

[英]How to remove specific number in string that is in random order?

Lets say that I have data rows that look like this:假设我有如下所示的数据行:

+----------------------------+
+   test_table               +
+----+--------+--------------+
+ id + word   + updated_word +
+----+--------+--------------+
+ 1  + g00gle + ggle         +
+ 2  + bread0 + bread        +
+ 3  + 0bject + bject        +
+ 4  + d0d0   + dd           +
+-------------+--------------+

What statement could I use to take out the zeroes in the word column, so that it looks like the updated_word column?我可以使用什么语句来删除 word 列中的零,使其看起来像 updated_word 列? I thought of using substring, but didn't know how to proceed after that.我想到了使用 substring,但不知道之后如何进行。

try:尝试:

UPDATE test_table 
SET word = REPLACE(word, '0', '');

replace the 2nd blank '' with anything you want to change with.将第二个空白 '' 替换为您想要更改的任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM