get record with max value of one specific column in each group using aggregate functions in group by sql in mysql
You can use the MAX() function in combination with the GROUP BY clause to get the record with the max value of one specific column in each group in MySQL. Here's an example query:
SELECT group_column, MAX(value_column) AS max_value
FROM your_table
GROUP BY group_column;
In this query, replace group_column with the name of the column you want to group by and value_column with the name of the column you want to get the max value from. The MAX() function will return the highest value for each group, and the GROUP BY clause will group the results by the group_column column. The alias max_value is used to give the result column a more descriptive name
原文地址: https://www.cveoy.top/t/topic/fFkm 著作权归作者所有。请勿转载和采集!