升序
select * from tablename order by column_name 
降序
select * from tablename order by column_name desc

解决方案 »

  1.   

    sql2000 (98以上的系统,不包括98)
    select * from table order by newid()
      

  2.   

    select * from (
    select '望而' a
    union select '小张'
    union select '小丁'
    union select '小李') A
    order by charindex(a,'小丁,小张,望而,小李')
      

  3.   

    order by charindex(a,'小丁,小张,望而,小李')
      

  4.   

    select * from (
    select '望而' a
    union select '小张'
    union select '小丁'
    union select '小李') A
    order by charindex(a,'小丁,小张,望而,小李')
      

  5.   

    select * from 你的表 order by charindex(你的列,'小丁小张望而小李')
      

  6.   

    1.小丁排第2
    select * from 表 order by charindex(列,'小张小丁望而小李')2。小丁排第2
    select * from 表 
    order by case when 列='小张' then 1
    when 列='小丁' then 2
    when 列='望而' then 3
    when 列='小李' then 4
    end
      

  7.   

    select * from table order by  case column_name 
    when '小丁' then 1
    when '小张' then 2
    when '小李' then 3
    ...end