I am not DB guy and I could not get why this simple case work perfectly on 5.6 but fail on 5.7 the weird way.
Use case: get the list of TOP-rated comic along with some info like title, author...
As long as I select only non-text colunm , then it sort correctly
SELECT c.id, c.title IF(AVG(r.score) IS NOT NULL, AVG(r.score), 0) as `rateScore`, COUNT(r.`entityId`) as `rateCount`
FROM `manga_comic` as c
LEFT JOIN `base_rate` as r
ON( r.`entityType` = 'comic' AND c.id = r.`entityId` )
GROUP BY c.`id`
ORDER BY `rateScore` DESC, rateCount DESC
Adding a text column like "c.description" will ignore rateScore while value rateCount.
Again, only 5.7 for me (or maybe some configuration which mess things up). I hope not to recode alot of screen just because of upgrading to mysql 5.7