当前位置: 数据库>sqlserver
提取手机号段的sql语句
来源: 互联网 发布时间:2014-08-29
本文导语: 提取手机号段的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(le...
提取手机号段的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前三位不同的总数和
---选择以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