douliedai4838 2018-09-17 16:48
浏览 92

当两个字段等于不同的表时,脚本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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题