MySQL selecting max record in group by
问题 I am trying to create a query in a table that has some 500,000 records and some 50 or 60 columns. What I need is to collate these records into groups and select the max record in each group. To simplify the problem I have a table as follows +----+-------------+----------+--------+ | id | external_id | group_id | mypath | +----+-------------+----------+--------+ | 1 | 1003 | 1 | a | | 2 | 1004 | 2 | b | | 3 | 1005 | 2 | c | +----+-------------+----------+--------+ The simple group by is as