select * from tbl 
order by date desc

解决方案 »

  1.   

    select * from tbl
    order by (case when 时间字段<getdate() then -1 else 
              datediff(minute,时间字段,getdate())) desc
      

  2.   

    --测试用例
    declare @t table(t_date varchar(50))
    insert into @t
    select '2005-8-23' union
    select '2005-10-11' union
    select '2005-12-23' union 
    select '2005-12-27' union
    select '2005-12-30'select * from @t order by t_date desc
    ---------------------------------------------
    /*
    2005-8-23
    2005-12-30
    2005-12-27
    2005-12-23
    2005-10-11
    */
      

  3.   


    --测试用例
    declare @t table(t_date smalldatetime)
    insert into @t
    select '2005-8-23' union
    select '2005-10-11' union
    select '2005-12-23' union 
    select '2005-12-27' union
    select '2005-12-30'select * from @t order by t_date desc
    ---------------------------------------------
    /*
    2005-12-30 00:00:00
    2005-12-27 00:00:00
    2005-12-23 00:00:00
    2005-10-11 00:00:00
    2005-08-23 00:00:00
    */
      

  4.   

    WangZWang(阿来) 
    按照你的做法好象语法错误,提示第一行')'附近语法错误
    我的问题好象没有完整,重开一贴
    一会结
      

  5.   

    declare @t table(t_date varchar(50))
    insert into @t
    select '2005-8-23' union
    select '2005-10-11' union
    select '2005-12-23' union 
    select '2005-12-27' union
    select '2005-12-30'select*
    from @t
    order by month(t_date)desc,day(t_date)asc
      

  6.   

    select * from tbl
    order by (case when 时间字段<getdate() then 
              datediff(minute,时间字段,getdate())*-1 else 
              datediff(minute,时间字段,getdate()) end) desc
      

  7.   

    谢谢 WangZWang(阿来)
    可以实现了,:)也谢谢各位