admin 管理员组

文章数量: 887006

mysql substring 下标

.html

取倒数 第二个 逗号 后面的

SELECT SUBSTRING_INDEX('Guangzhou,Guangzhou,Guangdong,China,CNGUA,China',',',-2)

结果 : CNGUA,China

截取

SELECT substring(

replace('Guangzhou,Guangzhou,Guangdong,China,CNGUA,China',SUBSTRING_INDEX('Guangzhou,Guangzhou,Guangdong,China,CNGUA,China',',',-2),''),

1,

length(replace('Guangzhou,Guangzhou,Guangdong,China,CNGUA,China',SUBSTRING_INDEX('Guangzhou,Guangzhou,Guangdong,China,CNGUA,China',',',-2),''))-1)

结果:

Guangzhou,Guangzhou,Guangdong,China

本文标签: mysql substring 下标