MySql按字段分组取最大值记录

数据库原始数据如下:数据库名:tbl_clothers   需求是:按照type分组,并获取个分组中price中的最大值,解决sql如下: 方法一: select * from (select type, name, price from tbl_clothers order by price desc) as a   group by a.type; 方法二: select a.* from
相关文章
相关标签/搜索