MySQL用GROUP BY分组取字段最大值或最新一条
其他数据还是按排序取,只有指定字段获取到最大值
SELECT id, max(operat_time) FROM tb GROUP BY id;
其他数据还是按排序取,只有指定字段获取到最小值
SELECT id, min(operat_time) FROM tb GROUP BY id;
按操作用户uid分组查最新一条操作记录
select * from (select * from tb order by operat_time desc) as a group by a.uid