先order by 再 groub by (order by 需要使用limit, 不然无效) select * from (select * from ab as a order by time desc limit 10000) as b group by time;
使用max() select * from ab as a, (select max(time) as time from ac group by time) as b, where a.time = b.time
UNION 和 UNION ALL
UNION 会去重复 和 排序, 所以UNION ALL性能比UNION好