Skip to content

Instantly share code, notes, and snippets.

@MarioCares
Created May 25, 2018 15:03
Show Gist options
  • Save MarioCares/7743973fd56ec376c00d9c449519ab76 to your computer and use it in GitHub Desktop.
Save MarioCares/7743973fd56ec376c00d9c449519ab76 to your computer and use it in GitHub Desktop.
insert into rrhh_licencia2
select id, licencia, fecha_emision, ingreso_at, inicio_at, termino_at, tipo_licencia,
COALESCE(tipo_reposo, 1) AS tipo_reposo, 1 AS reposo_lugar,
(CASE WHEN jornada = 0 THEN 1 WHEN jornada = 1 THEN 1 WHEN jornada = 2 THEN 2 WHEN jornada is null THEN 1 END) as jornada,
COALESCE(id_ocupacion, 19) AS id_ocupacion,
COALESCE(id_actividad, 9) AS id_actividad,
(CASE WHEN subsidio = 'A' THEN 1 WHEN subsidio = 'E' THEN 1 WHEN subsidio = 'B' THEN 2 WHEN subsidio = 'C' THEN 3
WHEN subsidio = 'D' THEN 4 WHEN subsidio = 'H' THEN 4 WHEN subsidio = 'F' THEN 5 WHEN subsidio = 'G' THEN 6 ELSE '7' END) AS subsidio,
usuario_id, usuario_ingresa,
(CASE WHEN estado = 1 THEN 1 ELSE 2 END) AS estado, medico,
COALESCE(vez, 0) AS ampliacion, monto, '.', 0 AS prevision, null, NULL
from rrhh_licencia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment