Skip to content

Instantly share code, notes, and snippets.

@maravilloso
Last active December 18, 2015 09:39
Show Gist options
  • Save maravilloso/5763304 to your computer and use it in GitHub Desktop.
Save maravilloso/5763304 to your computer and use it in GitHub Desktop.
Hacer INSERT directamente desde una SELECT
INSERT INTO gesegenv
(idproces, idnuafti, iddocper, cldocper, idlote, clcorreos, dedirec2, dedirec3, feenvio, nuenvio, clestado)
SELECT idproces, idnuafti, iddocper, cldocper, '0001', '', dedirec2, dedirec3, TODAY, 1, '001'
FROM gedatostit
WHERE NOT EXISTS(
SELECT * FROM gesegenv WHERE idproces=gedatostit.idproces AND idnuafti=gedatostit.idnuafti
)
AND idproces='DP2' AND clcenmuf='2500'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment