Skip to content

Instantly share code, notes, and snippets.

@diegoquintanav
Created June 2, 2018 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegoquintanav/109fa8fc243f69e8417ff5addfe97749 to your computer and use it in GitHub Desktop.
Save diegoquintanav/109fa8fc243f69e8417ff5addfe97749 to your computer and use it in GitHub Desktop.
comparacion resultados json

ejemplo de arica para allData_ddl_legend.json

 {
    "agno": 2016,
     "cod_com_alu": 15102,
     "cod_com_rbd": 15101,
     "cod_reg": 15,
     "flow": 64,
     "lat_com_alu": -19.155567,
     "lat_com_rbd": -18.47895865,
     "lon_com_alu": -70.18619999,
     "lon_com_rbd": -70.32132718,
     "nom_com_alu": "Camarones",
     "nom_com_rbd": "Arica"}
}

ejemplo resultado obtenido con la query

{
  "agno": 2015,
  "alias_sle_alu": "SLE01",
  "alias_sle_rbd": "SLE01",
  "cod_com_alu": 15202,
  "cod_com_rbd": 15201,
  "cod_depe2": 1,
  "cod_nivel": 8,
  "cod_oferta": 4,
  "cod_reg": 15,
  "cod_sle_alu": 1,
  "cod_sle_rbd": 1,
  "flow": 1,
  "gen_alu": 2,
  "id": 387517,
  "lat_com_alu": -17.59522993,
  "lat_com_rbd": -18.19656415,
  "lon_com_alu": -69.48126352,
  "lon_com_rbd": -69.55976064,
  "nom_com_alu": "General Lagos",
  "nom_com_rbd": "Putre",
  "nom_depe2": "Municipal",
  "nom_gen_alu": "Femenino",
  "nom_nivel": "8º Básico",
  "nom_nivel_short": "8°B",
  "nom_oferta": "Completa",
  "nom_reg": "Arica y Parinacota"
}

usando la siguiente query


SELECT cod_com_alu, lat_com_alu, lon_com_alu, cod_com_rbd, lat_com_rbd, lon_com_rbd, sum(flow) 
FROM public.paths
where cod_reg in (select distinct region_code from public.communes where city_code = 11)
group by cod_com_alu, lat_com_alu, lon_com_alu, cod_com_rbd, lat_com_rbd, lon_com_rbd;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment