select top 10 * from yourtable A
where id in (select top 2 * id from yourtable where supply = A.supply order by addtime desc)

解决方案 »

  1.   

    select * from 表 tem where addtime in (select top 2 addtime from 表 where supply=tem.supply order by addtime desc)
      

  2.   

    select top 10 * from 表 tem where id in (select top 2 id from 表 where supply=tem.supply order by addtime desc) order by  addtime desc
      

  3.   

    select top 10 * from 表 tem where id in (select top 2 id from 表 where supply=tem.supply order by addtime desc) order by supply desc
      

  4.   

    select top 10  *  from yourtable a where   (select count(1) from yourtable b
     where a.supply=b.supply and a.addtime<=b.addtime  ) <=2
     order by addtime
    断线拉!!
      

  5.   

    select top 10  *  from yourtable a where   (select count(1) from yourtable b
     where a.supply=b.supply and a.addtime<=b.addtime  ) <=2
     order by addtime
    断线拉!!
      

  6.   

    大力哥:tem是临时表?不用我建的吧!
      

  7.   

    不,它是别名,你可以乱写一个如:select top 10 * from 表 我是谁 where id in (select top 2 id from 表 where supply=我是谁.supply order by addtime desc) order by supply desc