How to use a MySQL statement to replace the last specified character of a value's contents
Please read this post before you answer http://bbs.csdn.net/topics/390705363?page=1#post-396787221
How to use a MySQL statement to replace the last specified character "/" of a value's contents
Like what
http://www.fuzhuang5.com/
Http://www.haolvlv.com/shandonglvyou/index.htm
Like the top two, the top one is to be replaced, and the following one is not replaceable because he has no/character at the back.
The value of this field includes a lot of/my requirements is to replace the last one
How does this string replace the last "/" with an empty one?
How to write this update statement
------Solution--------------------
You can have any one sentence.
Actually, your original post already has an answer.
Update tbl_name set field_name=if (field_name REGEXP '/$ ', substr (Field_name,1,length (field_name)-1), field_name)
Update tbl_name set field_name=if (field_name rlike '/', substr (Field_name,1,length (field_name)-1), field_name)
Update tbl_name Set FIELD_NAME=SUBSTR (Field_name,1,length (field_name)-1) where Field_name REGEXP '/$ '
Update tbl_name Set FIELD_NAME=SUBSTR (Field_name,1,length (field_name)-1) where Field_name rlike '/'
Update tbl_name Set Field_name=left (Field_name,length (field_name)-1) where Field_name REGEXP '/$ '
Update tbl_name Set Field_name=left (Field_name,length (field_name)-1) where Field_name rlike '/'