Ver originalSELECT T1.*FROM tu_tabla T1 INNER JOIN( SELECT codigo, MAX(numero) max_num FROM tu_tabla GROUP BY codigo) T2 ON T1.codigo = T2.codigo AND T1.numero = T2.max_num