select * from 表 a,(select max(time) max, 字段 from 表名
group by 字段) b where a.字段= b.字段 and a.time = b.max
MYSQL根据时间先排序,再根据另一个字段去重,保存最新时间的记录
最新推荐文章于 2023-05-23 09:56:44 发布
select * from 表 a,(select max(time) max, 字段 from 表名
group by 字段) b where a.字段= b.字段 and a.time = b.max