I have a problem when use Order By and Group By in a query string.
There is a table careers that contains data as shown below:
id se_id enrollment_start ------------------------- 1 1 2005-07-01 2 2 2008-10-12 3 2 2006-05-09 4 1 2016-11-10 5 3 2015-02-04 6 3 2010-08-11
I want to get se_id which has highest enrollment_start.
This is a sql statement I used. It works in mysql 5.5 but not in mysql 5.7:
SELECT tmp.* FROM (SELECT * FROM careers ORDER BY enrollment_start DESC) tmp GROUP BY tmp.se_id
This is groupwise maximum problem, and there are many topics cover about it. But I don't want the answer for that problem, I want to know why above statement woking in mysql 5.5 but it doesn't work in mysql 5.7 and is there any method to fix it? Thank you.