select f1,f3,max(f2) as f2 from table1 group by f1,f3

解决方案 »

  1.   

    select * from table1 aa where not exists (select 1 from table1 bb where aa.f1=bb.f1 and aa.f2<bb.f2)
      

  2.   

    select f1,f3,f2 from (select f1,max(f2)as f2 from table1 group by f1) a,table1 b where a.f2=b.f2
      

  3.   

    select a.f1,a.f2,b.f3 from (select f1,max(f2)as f2 from table1 group by f1) a 
                INNER JOIN table1 b ON b.f1 = a.f1
      

  4.   

    select * from table1 tem where f2=(select max(f2) from table1 where f1=tem.f1)
      

  5.   

    select f1,f2,f3 from table1 ta where f2=(select max(f2) from table1 where f1=ta.f1)