select
    *
from
   表 A
where not exists
   (select 1 from 表 catalogid<>A.catalogid and adddate>A.adddate)

解决方案 »

  1.   

    select * from table t where (select count(addDATE) from table where catalogid=t.catalogid and infoid>=t.infoid)<=1
    order by t.infoid,t.addDATE
      

  2.   

    select
        *
    from
        表 A
    where not exists
       (select 1 from  表 where catalogid=A.catalogid and adddate>A.adddate)
      

  3.   

    create table #tblRecord ([infoid] int,catalogid int,rTime datetime)
    insert into #tblRecord select 1,1,getdate()
    insert into #tblRecord select 2,3,getdate()
    insert into #tblRecord select 3,1,getdate()-1
    insert into #tblRecord select 4,2,getdate()
    insert into #tblRecord select 5,2,getdate()-2select catalogid,max(rTime) from #tblRecord
    group by catalogid
      

  4.   

    to :zlp321002(她是我的唯一.) 
    为什么还是取出几条重复的记录呢,是一个类别下的
      

  5.   

    yinwun(努力学习中) 的回答是正确的。
      

  6.   

    to: zlp321002(她是我的唯一.) 还是不行.有几条重复了的记录!
      

  7.   

    我用的存储过程和你的结果一样.因为我在库中循环插入了1w条测试数据.adddate是自动获取的,有很多都相同.但是每次只出现一个类别下重复几条.
      

  8.   

    select catalogid,max(adddate)adddate from 表 group by catalogid
      

  9.   

    to:yinwun(努力学习中)insert into #tblRecord select 1,1,getdate(),select后面的是什么意思啊,不懂