Ver originalSELECT *FROM ( SELECT codigo, nombre, direccion, montos, ROW_NUMBER() OVER (partition BY codigo ORDER BY montos DESC) x FROM tabla) tWHERE x <= 8