开发者社区 问答 正文

mysql中获取最大记录组的优化

sql语句如下

select did,t.direction,t.latitude,t.longitude,t.speed from t_car_locus t where t.id = (select max(t1.id) from t_car_locus t1 where t1.did = t.did)
请问这个sql语句如何优化一下能让性能最高?

该条语句是查找不同did最后上传的一条记录。

展开
收起
a123456678 2016-06-29 13:51:02 2131 分享 版权
1 条回答
写回答
取消 提交回答