Skip to content

Instantly share code, notes, and snippets.

@snahor
Created December 22, 2010 18:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save snahor/751869 to your computer and use it in GitHub Desktop.
SELECT
(SELECT name
FROM ubigeo u0
WHERE u0.province_code = ubigeo.province_code
AND u0.department_code = ubigeo.department_code LIMIT 1) AS "provincia",
(SELECT name
FROM ubigeo u0
WHERE u0.department_code = ubigeo.department_code LIMIT 1) AS "departamento",
"ubigeo"."id", "ubigeo"."department_code", "ubigeo"."province_code", "ubigeo"."district_code", "ubigeo"."name" FROM "ubigeo" WHERE "ubigeo"."id" = 758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment