vijayfly

mysql字符串根据指定字符分割

1.分割函数:SUBSTRING_INDEX(\'浙江温州-中国电信\',\'-\',\'1\')

2.用例(筛选\'-\'前至少4个汉字的数据)

a.数据分布

b.筛选sql

select t.mobile_number_home ,
       SUBSTRING_INDEX(t.mobile_number_home,\'-\',1) 
from company t
where LENGTH(SUBSTRING_INDEX(t.mobile_number_home,\'-\',1)) >= 12
LIMIT 20000

注释:每个汉字3个长度

 c.结果

分类:

技术点:

相关文章:

  • 2022-01-31
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2021-05-18
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2021-11-29
相关资源
相似解决方案