sql >> Base de Datos >  >> RDS >> Mysql

SQL:seleccione 'n' elementos más grandes en el grupo

select * from users as t1
where (select count(*) from users as t2
       where t1.division = t2.division and t2.rank > t1.rank) <2
order by division,rank