select * from tbname,(
select bid,max(coldate) coldate from tbname group by bid) t
where t.bid=tbname.bid and t.coldate=tbname.coldate;

解决方案 »

  1.   

    select a.id,a.bid,a.date
     from 表名 a, (select bid,max(date) from 表名 group by bid) b
    where a.bid=b.bid and a.date=b.date
      

  2.   

    select id,bid max(date) from t1 group by bid
      

  3.   

    select a.*
     from 表名 a, (select bid,max(date) date from 表名 group by bid) b
    where a.bid=b.bid and a.date=b.date order by a.id
      

  4.   

    select id from 表名 where date in (select max(date) from 表名 group by bid);
    不知道这样可不可以啊!
      

  5.   

    select * from (select row_number() over(partition by bid order by id desc) rm,a.* from table_name a) where rm=1