select * from 表 t
where not exists(select 1 
                    from 表 
                       where catalogid=t.catalogid 
                              and showid=t.showid 
                              and version>t.version)

解决方案 »

  1.   

    select * from tb a
    where not exists( select 1 from tb where catalogid=a.catalogid and showid=a.showid 
    and version>a.version)
      

  2.   

    select * from table1 t
    where not exists(select 1 
                        from table1 
                           where catalogid=t.catalogid 
                                  and showid=t.showid 
                                  and version>t.version)
    或者
    select id=(select top 1 id from table1 b where b.version=a.version ),catalogid ,showid , max(version) from table1 a  group by catalogid , showid  
      

  3.   

    select * from tb a
    where not exists( 
        select 1 from tb 
        where catalogid=a.catalogid and showid=a.showid 
             and( version>a.version or  version=a.version and id>a.id))
      

  4.   

    谢谢,要有id>a.id。
    not exists?
    select 1 from  中的1   ?初学者!