提取手机号段的sql语句

发布时间:2020-02-08编辑:脚本学堂
提取手机号段的sql语句,供大家学习参考。
复制代码 代码如下:SELECT count(left(section,3)) as number,distinct(type) FROM `tel` where section like '134%'
---

提取手机号段的sql语句,供大家学习参考。
 

复制代码 代码如下:
SELECT count(left(section,3)) as number,distinct(type) FROM `tel` where section like '134%' 
---选择以134开始的134****号段之和number,以类型区分(1移动,2联通,3电信)
SELECT count(distinct(left(section,3))) FROM `tel`
---取section前三位不同的总数和
SELECT count(distinct(left(section,3))) as number FROM `tel` where section like "189%"
---取189开始section前三位不同的总数和

多表查询SQL语言
 

复制代码 代码如下:
select j.name as names,m.*,o.* from member as m,organ as o,job as j where m.arganid=o.id and m.job=j.id