mysql5.7.9分组查询中的子查询排序不生效。mysql5.6生效。

SELECT *FROM ( SELECT id, user_id, report_store_user_id, create_time FROM tb_store_user_report ORDER BY id DESC ) AS iGROUP BY user_id结果:两个数据库数据是一样的

第1个回答  2017-08-04
你可以在子查询里加个limit子句试试, 据说mysql5.7子查询不加limit的话, order by会被优化掉
第2个回答  2017-07-13
出现了同样的问题,mysql升级了 数据错了
第3个回答  2016-07-19
ORDER BY
id DESC放外面
能行不
你的逻辑比较混乱,说清需求,帮你从写个追问

分组查询,查最新的那一条数据,排序条件create_time

相似回答