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;