order by obj -- 这样不就是按obj字母排序吗(你又不是中文)

解决方案 »

  1.   

    declare @t table(id int, obj varchar(10))
    insert @t select 1,  'a' 
    insert @t select 2,  'cg' 
    insert @t select 3,  'e' 
    insert @t select 4,  'ga' 
    insert @t select 5,  'ert' 
    select * from @t order by left(obj,1)asc
      

  2.   

    select * from [table] order by left(obj,1) asc
      

  3.   

    select * from tb order by left(obj,1) asc
      

  4.   

    declare @t table(id int, obj varchar(10)) 
    insert @t select 1,  'a' 
    union all select 2,  'cg' 
    union all select 3,  'e' 
    union all select 4,  'ga' 
    union all select 5,  'ert' 
    union all select 6,  'eat' 
    union all select 7,  'ecta' 
    union all select 8,  'ertb' 
    select * from @t order by obj+'000000000'/*
    id          obj        
    ----------- ---------- 
    1           a
    2           cg
    3           e
    6           eat
    7           ecta
    5           ert
    8           ertb
    4           ga(所影响的行数为 8 行)
    */应该这样
    第一个相同就再比较第二个字母
      

  5.   

    不理解 普通的order by 语句就是按照第一个字母排序的,第一个相同的话才会按第2个排,以此类推。普通的order by 语句是完全满足你的需求的
      

  6.   

    那就接点分吧--order by obj