select dev_id ,row_number()over(partition by dev_id order by port_id asc) nums from tst_publicroute_all;