Last active
October 6, 2020 23:00
-
-
Save arbo-hacker/410520c66ba71251f8a8 to your computer and use it in GitHub Desktop.
Actualizar tabla con inner join en ORACLE
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
UPDATE tabla1 t1 | |
SET t1.valor = (SELECT t2.CODE FROM tabla2 t2 WHERE t1.valor = t2.DESC and t1.fecha=t2.fecha) | |
WHERE t1.filtro='correcto' | |
AND EXISTS (SELECT t2.CODE FROM tabla2 t2 WHERE t1.valor = t2.DESC and t1.fecha=t2.fecha); | |
-- O | |
UPDATE | |
(SELECT t1.valor as OLD, t2.CODE as NEW | |
FROM tabla1 t1 | |
INNER JOIN tabla2 t2 | |
ON t1.valor = t2.DESC | |
and t1.fecha=t2.fecha | |
WHERE t1.filtro='correcto' | |
) t | |
SET t.OLD = t.NEW; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment