select * from 表 order by right([考号],3)

解决方案 »

  1.   

    select * from tablename
    order by right(考号,3)
      

  2.   

    create table tb7 (考号 varchar(10)  ,姓名 varchar(8))
    insert into tb7
    select '01010001',''
    union all select '01100002',''
    union all select '01020006',''
    union all select '01300007',''
    union all select '01050004',''
    union all select '01000003',''select * from tb7 order by right(考号,4)
      

  3.   

    select * from tb7 order by stuff(考号,1,3,'')
      

  4.   

    select * from 表 order by right([考号],3)
      

  5.   

    select * from tablename
    order by left(考号,3)
      

  6.   

    select * from TableName
    order by left(考号,3)
      

  7.   

    1.order by是要使用的。
    2.stuff函数用得少些,建议用根据实际情况使用left、right、substring函数来取得要参加排序的字符。