select * from t where exists (select 1 from (select id,max(time) as time from t group by id) x where x.id=t.id and x.time=t.time把t 换成你的表名,一共有4个哦