This is my query:
SELECT AVG(user_reviews.rate) AS SQLAVG,facilities_stores.*
FROM `facilities_stores`
LEFT JOIN user_reviews ON user_reviews.facility_id = facilities_stores.id
WHERE facilities_stores.id IN (17,20,21,35)
GROUP BY facilities_stores.id ORDER BY SQLAVG DESC
If this is SUM or COUNT. This query working fine.
But when it is AVG not work.
This query working fine with Mysql < 5.6. I'm not sure what I'm wrong.
Look like at Mysql 5.7 have conflict of ORDER BY
with GROUP BY
This is my result