select * from 表 ta where 值 in (select top 3 值 from 表 where  组=ta.组 order by 日期desc)

解决方案 »

  1.   

    --假设你的字段如此,并且你的id是唯一的
    id  type data dateselect * from tablename a 
    where id in (select top 3 id from tablename where type =a.type )
      

  2.   

    --try:select * from T
    where 3>(select count(*) from T a where a.商品编码=T.商品编码 and a.id<T.id)
      

  3.   

    UP UP UP  UP UP 楼上
    select * from tablename a 
    where id in (select top 3 id from tablename where type =a.type )