I need to query remove / from url fields in the table menu
original table
menuname url
home /home/
about /home/about/
requirement
menuname url
home home
about home/about
这是从字段中删除尾部斜杠的方法:
UPDATE `table_name` SET `field_name`=TRIM(TRAILING '/' FROM `field_name`)
SELECT TRIM( BOTH '/' FROM '/bar/' )
编辑
SELECT TRIM(BOTH '/' FROM link ) FROM menu
See http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_trim
Example:
SELECT TRIM(BOTH '/' FROM home, about) FROM 'table_name';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.