根据select * from tb 查询的结果如下:ID     score           getTime
4 50 2010-11-23 22:11:52.990
2 50 2010-11-23 22:11:08.140
1 50 2010-11-23 22:10:46.657
3 44 2010-11-23 22:11:18.233现在需要根据分数倒序排序,但是又要将时间也按倒序排序,想得到最终的结果如下:ID     score           getTime
4 50 2010-11-23 22:11:52.990
2 50 2010-11-23 22:11:08.140
1 50 2010-11-23 22:10:46.657
3 44 2010-11-23 22:11:18.233

解决方案 »

  1.   


    select * from tb order by score desc,getTime desc
      

  2.   

    create table tb(ID int,score int,getTime datetime)
    insert into tb select 4,50,'2010-11-23 22:11:52.990'
    insert into tb select 2,50,'2010-11-23 22:11:08.140'
    insert into tb select 1,50,'2010-11-23 22:10:46.657'
    insert into tb select 3,44,'2010-11-23 22:11:18.233'
    go
    select * from tb order by score desc,gettime desc
    go
    drop table tb
    /*
    ID          score       getTime
    ----------- ----------- -----------------------
    4           50          2010-11-23 22:11:52.990
    2           50          2010-11-23 22:11:08.140
    1           50          2010-11-23 22:10:46.657
    3           44          2010-11-23 22:11:18.233(4 行受影响)
    */