当两个字段等于不同的表时,脚本sql,改变一个字段

I have the following table called tbdetailsreserv_agency fields-tbdetailsreserv_agency

and the next table called tbreserv_agency

fields-tbreserv_agency

as you can see the Regisfolio value of the table tbreserv_agency is associated with Idreserv, for example the Idreserv 12,13 have the value of RegisFolio 2457, the idea is that the registers with RegisFolio are the same as the same Idreserv

with the following query I get a view that I need

 SELECT tbdetailsreserv_agency.idDetails_agency as idDetalle,tbdetailsreserv_agency.idReserv as idReservdetalle,tbreserv_agency.idReserv as reservaAgencia,RegisFolio
         FROM tbldetallesreservas_agencias, tblreservas_agencias 
         WHERE tbreserv_agency.idReserv = tbdetailsreserv_agency.idReserv

tb-final

also here I use the table tbdetailsreserv_agency, but it is not the way I need the data, returning to the example above the tables tbdetailsreserv_agency and tbreserv_agency has the value idreserv = 12 and shared the RegisFolio = 2457 what is correct, but now the next value of Idreserv is 14, skip 13.

The final form that I look for is like this

tabla-finaltrue

I would need an orderly way of the Idreserv data so that the numbers are not skipped

Do you already have that data? I have to update them to the database with the new values. What would be the correct way to carry out this process?

thank you very much for all the contributions