How to replace a regex pattern in MySQL

后端 未结 4 1265
感情败类
感情败类 2021-01-29 11:55

I have a table called myTable which has a column called col1. This column contains data in this format: (1 or 2 digits)(hyphen)(8 digits).

I wa

4条回答
  •  误落风尘
    2021-01-29 12:31

    Looking to your pattern seem you could avoid regexp

    update myTable  
    set col1  = concat('4-', right(col1,8))
    

    or

    update myTable  
    set col1  = concat('4', right(col1,9))
    

提交回复
热议问题