解决方案 »

  1.   

    try this:--drop table tbcreate table tb(v varchar(10))insert tb 
    select '001' union all
    select '00125' union all
    select '002' union all
    select '0032' union all
    select '011' union all
    select '012' union all
    select '02' union all
    select '111' union all
    select '1121' union all
    select '32'
    goselect *
    from tb
    order by LEFT(v,2),SUBSTRING(v,3,1)
      

  2.   

    直接order.
    create table tb(v varchar(10))
    go
    insert tb 
    select '001' union all
    select '00125' union all
    select '002' union all
    select '0032' union all
    select '011' union all
    select '012' union all
    select '02' union all
    select '111' union all
    select '1121' union all
    select '32'
    go
    select *
    from tb
    order by v/*
    v
    ----------
    001
    00125
    002
    0032
    011
    012
    02
    111
    1121
    32(10 行受影响)*/
    go
    drop table tb
      

  3.   

    select *
    from tb
    order by LEFT(v,2),SUBSTRING(v,3,1)
      实现的就是按前两位,第三位排序
      

  4.   

    select * from tb order by LEFT(v,3)
      

  5.   

    直接 select *from tb order by v不就行了! 为什么要那么麻烦?