return fields of record with max value of time in each group when using group by mpId in mysql
Assuming the table name is "records" and the field names are "mpId" and "time", the following SQL query can be used:
SELECT mpId, MAX(time) as max_time FROM records GROUP BY mpId
This query will return two fields: "mpId" and "max_time", where "max_time" is the maximum value of "time" for each group of "mpId".
原文地址: https://www.cveoy.top/t/topic/fFkx 著作权归作者所有。请勿转载和采集!