我的数据库表A中全是移动的手机号
排序没有规律
我想让它们按从小到大排列
怎么写这个sql 语句?

解决方案 »

  1.   

    create table test(code nvarchar(20))
    insert into test(code)
    select '11111111115' union all
    select '11111111112' union all
    select '11111111113' union all
    select '11111111114' union all
    select '11111111111'select * from test
    select * into test2 from test order by code asc delete from testinsert into test(code)
    select code from test2select * from testdrop table test2
    drop table test
      

  2.   

    select convert(int,手机号码)   
    from 表
    order by 手机号码
    或者select 手机号码   
    from 表
    order by 手机号码
      

  3.   

    select * from tablename order by phoneNO
      

  4.   

    哦!明白了!再创建一个过渡表!
    1:创建 new_table(与old_table 结构完全相同)
    2:
    select  *  from   old_table order by 手机号码
    insert into new_table3:delete old_table
      

  5.   

    create table test(code nvarchar(20))
    insert into test(code)
    select '11111111115' union all
    select '11111111112' union all
    select '11111111113' union all
    select '11111111114' union all
    select '11111111111'select * from test
    select * into test2 from test order by code asc -- 排序导入新表delete from test -- 删除以前的数据insert into test(code)
    select code from test2 -- 导入新表select * from testdrop table test2 
    drop table test
      

  6.   

    select '11111111115' union all
    select '11111111112' union all
    select '11111111113' union all
    select '11111111114' union all
    select '11111111111'
    楼上大哥
    这是什么意思啊?