🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
#### 参考 ``` SELECT t1.* FROM your_table t1 INNER JOIN ( SELECT id, MAX(timestamp) AS max_timestamp FROM your_table GROUP BY id ) t2 ON t1.id = t2.id AND t1.timestamp = t2.max_timestamp; ``` 实现: 改前: ![](https://img.kancloud.cn/c1/eb/c1eb4baff0260f10fe8dc72bb4ec3389_1225x570.png) 优化后: ![](https://img.kancloud.cn/8b/54/8b5401254e5a3eb96021037052be7ead_1205x561.png)