有没有办法让 group by 执行前分组?有的 ,子查询!


最简单的 :
SELECT * FROM (SELECT * FROM posts ORDER BY dateline DESC) GROUP BY  tid ORDER
BY dateline DESC LIMIT 10 eg:元宝余额查询
条件:要根据acct_id分组,找出最近的一条记录,并根据newyuanbao降序排序。 "SELECT acct_id,newyuanbao FROM
(SELECT acct_id,newyuanbao FROM chongzhi_ok ORDER BY `timestamp` DESC) A GROUP
BY A.acct_id ORDER BY A.newyuanbao+0 DESC LIMIT 100";