原来 字符 为 

Abbeville (AL)  USABB
trim(REVERSE(SUBSTRING(REVERSE('Abbeville (AL)  USABB'),LOCATE(' ',REVERSE('Abbeville (AL)  USABB') ),LENGTH('Abbeville (AL)  USABB') ) ) ) 


//结果 为
Abbeville (AL)

 


 

 

 

原  :

SAMARINDA, KALIMANTA, INDONESIA
SELECT trim(REVERSE(SUBSTRING(REVERSE('SAMARINDA, KALIMANTA, INDONESIA'),LOCATE(',',REVERSE('SAMARINDA, KALIMANTA, INDONESIA') )+1,LENGTH('SAMARINDA, KALIMANTA, INDONESIA') ) ) ) 

结果 

  SAMARINDA, KALIMANTA

 

_____________________________________________________________________________________________________________________________

 

截取 倒数 第三个 逗号 之前的

 

SELECT REVERSE(SUBSTRING_INDEX(REVERSE('Busan(warehouse), ,Busan,South Korea,KRBUW,South Korea'), ',', -3)) 

结果为

Busan(warehouse), ,Busan

 

 

 


https://www.cnblogs.com/heyonggang/p/8117754.html