Skip to content
Snippets Groups Projects
Commit 663f54ff authored by Edu Trevisan's avatar Edu Trevisan
Browse files

Add equipes de saude table resources

parent 0f64f8dd
Branches
No related tags found
No related merge requests found
--
--Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
--Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
--
--This file is part of SMPPIR-Tables.
--
--SMPPIR-Tables is free software: you can redistribute it and/or modify
--it under the terms of the GNU General Public License as published by
--the Free Software Foundation, either version 3 of the License, or
--(at your option) any later version.
--
--SMPPIR-Tables is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU General Public License for more details.
--
--You should have received a copy of the GNU General Public License
--along with SMPPIR-Tables. If not, see <https://www.gnu.org/licenses/>.
--
CREATE TABLE Brasil AS
SELECT
regiao.id AS regiao_id,
regiao.nome AS nome_regiao,
estado.id AS estado_id,
estado.nome AS nome_estado,
estado.sigla AS sigla_estado,
municipio.id AS municipio_id,
municipio.nome AS nome_municipio
FROM
regiao,
estado,
municipio
WHERE
regiao.id = estado.regiao_id AND
estado.id = municipio.estado_id
;
\ No newline at end of file
--
--Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
--Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
--
--This file is part of SMPPIR-Tables.
--
--SMPPIR-Tables is free software: you can redistribute it and/or modify
--it under the terms of the GNU General Public License as published by
--the Free Software Foundation, either version 3 of the License, or
--(at your option) any later version.
--
--SMPPIR-Tables is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU General Public License for more details.
--
--You should have received a copy of the GNU General Public License
--along with SMPPIR-Tables. If not, see <https://www.gnu.org/licenses/>.
--
CREATE TABLE esf_quilombolas AS
SELECT
brasil.municipio_id AS municipio_id,
brasil.nome_municipio AS nome_municipio,
brasil.estado_id AS estado_id,
brasil.sigla_estado AS sigla_estado,
brasil.nome_estado AS nome_estado,
brasil.regiao_id AS regiao_id,
brasil.nome_regiao AS nome_regiao,
equipes_saude.cod_municipio AS id_municipio_equipes,
equipes_saude.no_referencia AS nome_equipe,
equipes_saude.ano_censo AS ano_censo
FROM
(SELECT municipio_id AS id, (municipio_id / 10) AS id_6 FROM brasil) AS novo_id,
equipes_saude,
brasil
WHERE
novo_id.id = brasil.municipio_id AND
equipes_saude.cod_municipio = novo_id.id_6 AND
equipes_saude.tp_pop_assist_quilomb = 1
ORDER BY
equipes_saude.ano_censo,
brasil.regiao_id,
brasil.estado_id
;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment