Looking at the MySql documentation about row_number() over()
I see what can be done, I'm copying exactly the same example adapting it to the database I work with but it gives the following error
"(" is not valid at this position, expecting: EOF, ';'
I leave the selection for you to see it. Thanks in advance.
select e.esap_codigo, e.esap_iden,
ROW_NUMBER() over(partition by e.esap_codigo order by e.esap_codigo, e.esap_iden) as num
from esap_hco_estados_aparatos e;