SELECT * FROM TABLEA T WHERE NOT EXISTS(SELECT 1 FROM TABLEA WHERE mathchid=T.mathchid AND
chipintypeid=T.chipintypeid AND ID>T.ID)

解决方案 »

  1.   

    --1
    select t.* from tablea t where changedate = (select max(changedate) from tablea where mathchid = t.mathchid and chipintypeid = t.chipintypeid)--2
    select t.* from tablea t where not exists (select 1 from tablea where mathchid = t.mathchid and chipintypeid = t.chipintypeid and changedate > t.changedate)
      

  2.   


    select t.* 
    from tablea t 
    where 
    not exists (select 1 from tablea where mathchid = t.mathchid and chipintypeid = t.chipintypeid and changedate > t.changedate)