mysql get the record with the maximum value after grouping

The project is tested personally, and millions of pieces of data can be obtained instantly


select a.* from table_test a ,(select b.gcol,max(b.id) maxid from table_test b group by b.gcol )c where c.maxid = a.id


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325981705&siteId=291194637