select a.* from a, (select fid,max(time) time from a group by fid) b where a.fid=b.fid and a.time=b.time