比如有号码13660023232
13332322332怎么如何 sql 区分移动联通号码或直接查询出 移动的 号码

解决方案 »

  1.   


    select case when left(col,3) in ('130,131,132,133') then '联通' else '移动' end
    from tab
      

  2.   

    select case when left(col,3) in ('130','131','132','133') then '联通' else '移动' end 
    from tab
      

  3.   

    加一个判断就可以了.
    declare @tel varchar(20)
    set @tel = '13660023232'
    select case when cast(left(@tel,3) as int) >= 134 then '移动' else '联通' end 
      

  4.   

    select 号码 , case when left(号码,3) in ('135','136','137','138','139','155','156','157','158','159') then '电信/移动' else '联通' end from tb
      

  5.   

    select case when convert(int,substring(column,1,3))<=135 then '联通' else '移动' end '类型' from table 
      

  6.   


    select case when convert(int,substring(column,3,1))<=5 then '联通' else '移动' end '类型' from table 
      

  7.   


    select * from table  where convert(int,substring(column,3,1))<=5//联通
    select * from table  where convert(int,substring(column,3,1))>5//移动
      

  8.   

    select case when left(col,3) in ('130','131','132','133','153','156') then '联通' else '移动' end 
    from tab
      

  9.   

    联通:
    gsm:130,131,132,133,153,156移动:
    1340-1348,135,136,137,138,139,150,157,158,159157好像是TD段