mysql基础 substring 字符串截取 ,SUBSTRING_INDEX
https://www.cnblogs.com/zdz8207/p/3765073.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