Created
May 16, 2019 17:00
-
-
Save alfredoem/5dda432e7d9a30dd6bdfe1fa8d182008 to your computer and use it in GitHub Desktop.
Outer Join Mysql
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
SELECT | |
u.nombre, | |
ine.departamento, | |
ine.provincia, | |
ine.distrito | |
FROM mod_ubigeo_departamento AS u | |
LEFT JOIN ubigeo_inei AS ine ON UPPER(u.nombre) = UPPER(ine.departamento) | |
WHERE ine.departamento IS NULL | |
GROUP BY u.nombre | |
UNION | |
SELECT | |
u.nombre, | |
ine.departamento, | |
ine.provincia, | |
ine.distrito | |
FROM mod_ubigeo_departamento AS u | |
RIGHT JOIN ubigeo_inei AS ine ON UPPER(u.nombre) = UPPER(ine.departamento) | |
WHERE u.nombre IS NULL | |
GROUP BY u.nombre; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment