| 发表于:2007-06-20 19:19:213楼 得分:10 |
create table test(d1 int,d2 int) insert test select 1,1 union all select 1,2 union all select 1,3 union all select 2,1 union all select 2,2 union all select 2,3 union all select 2,4 select * from test a where d2 in ( select top 2 d2 from test where d1=a.d1 order by d2 desc ) order by d1,d2 desc | | |
|