Mysql
 sql >> Datenbank >  >> RDS >> Mysql

So wählen Sie den Datensatz aus, der MAX(some_field) in GROUP(group by) enthält

select a.*
from table_A a
inner join (
    SELECT another_field, MAX(some_field) as MaxSomeField
    FROM table_A 
    GROUP BY another_field
) am on a.another_field = am.another_field and a.some_field = am.MaxSomeField