Created
November 2, 2016 14:43
-
-
Save MarioCares/1c6d87c6184ccf5ac3900e30e1b66b08 to your computer and use it in GitHub Desktop.
Arreglo condoro Ismael del día 02-11-2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1) IDENTIFICAR LAS FILAS QUE ESTÁN EN LA TABLA BAK, PERO NO EN LA ORIGINAL | |
select fp2.* | |
from finanzas_proveedor as fp1 | |
right join finanzas_proveedor_bak as fp2 on fp1.id = fp2.id | |
where fp1.id is null; | |
-- 2) INSERTAR EN LA TABLA ORIGINAL LAS FILAS QUE FUERON BORRADAS | |
insert into finanzas_proveedor | |
(select fp2.* | |
from finanzas_proveedor as fp1 | |
right join finanzas_proveedor_bak as fp2 on fp1.id = fp2.id | |
where fp1.id is null); | |
-- 3) ACTUALIZAR LA COLUMNA DE LA TABLA ORIGINAL, DESDE LA COLUMNA EN LA TABLA BAK | |
update finanzas_documento_tributario as dt1 | |
inner join finanzas_documento_tributario_bak as dt2 on dt1.id = dt2.id | |
set dt1.proveedor_id = dt2.proveedor_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment