Last active
August 29, 2015 14:14
-
-
Save MarioCares/7971142810128ebd7844 to your computer and use it in GitHub Desktop.
Query SQL Migración Tablas: Facturas y Boletas dependientes de Órdenes
This file contains 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
insert into finanzas_documento_egreso | |
select pag_pk_id, pag_fk_cuclapre, pag_fk_fo, | |
(CASE pag_fk_usuario | |
WHEN "Mónica Salinas" THEN "15090763" | |
WHEN "Marcela Valenzuela" THEN "10534153" | |
WHEN "Tomás Ahumada" THEN "8769776" | |
WHEN "Vaneza Viza" THEN "10736574" | |
ELSE pag_fk_usuario | |
END) as pag_fk_usuario, | |
pag_fk_espa, pag_fk_prov, pagord_fk_orco, pag_fk_memo, pag_numero, pag_fecha, 0, pag_total, pag_detalle, "SALUD", tieg_descripcion | |
from saludcor_adquisiciones.pago | |
inner join saludcor_adquisiciones.pagosordenes on pagosordenes.pagord_fk_fac = pago.pag_pk_id | |
inner join saludcor_adquisiciones.tipoegreso on tipoegreso.tieg_pk_id = pago.pag_fk_tieg | |
where pag_fk_tieg in (1,2) and year(pag_fecha) = 2014 and month(pag_fecha) != 12 limit 10000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment