SQL语句 查询记录里分组后按照时间排序 先将所有记录按照时间倒叙,然后做为嵌套子记录,分组后排序即可 SELECT * FROM (SELECT * FROM ed_diagnosis ORDER BY createtime DESC) a GROUP BY softPackageId ORDER BY createtime DESC LIMIT 10