Você pode usar
row_number()
:delete
from (select nm.*,
row_number() over (order by id desc) as seq
from nametable nm
) nm
where seq > 500;
Dessa forma, ele excluirá todos os inícios de registro inicial de
501
. row_number()
:delete
from (select nm.*,
row_number() over (order by id desc) as seq
from nametable nm
) nm
where seq > 500;
501
.