web | Java

有一个表A:班级,姓名,性别,身高,求每个班级身高最高的数据

千锋教育

select A.* from A join ( select class,max(height) `max_height` from A group by class ) 


t1 on A.class = t1.class and A.height = t1.height; select class, name, sex, height from ( select class, name, sex, height, rank() over(partition by class order by height desc) `rank` from A ) t1 where t1.rank = 1;