Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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? I thought of using substring, but didn’t know how to proceed after that.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

try:

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

replace the 2nd blank ” with anything you want to change with.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading