Home > Back-end >  How to remove specific number in string that is in random order?
How to remove specific number in string that is in random order?

Time:01-30

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.

CodePudding user response:

try:

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

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

  • Related