Get the App
SLTechnology News&Howtos  ›  Database  › 

Take the same field and the maximum record of another field in SQL

Shulou Source: shulou.com Published: 2022-06-01 13:30:49 11月08日 Update

Sql takes the record with the largest value of the B field of the repeated record in the A field

Select max (id) id,name from table group by name

If there are other fields in the table to find out, then

Select * from table where id in (select max (id) from table group by name)

Tags: Field maximum same Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Apple Xiaomi Linux