Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SQL Scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HOTMapper
SQL Scripts
Commits
0d855392
Commit
0d855392
authored
3 years ago
by
Pietro Cavassin
Browse files
Options
Downloads
Patches
Plain Diff
remove 99 period from projecao matricula por dependencia
parent
8788fa8c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
projecao_matricula_por_dependencia.sql
+4
-3
4 additions, 3 deletions
projecao_matricula_por_dependencia.sql
with
4 additions
and
3 deletions
projecao_matricula_por_dependencia.sql
+
4
−
3
View file @
0d855392
...
...
@@ -3,7 +3,7 @@ CREATE TABLE projecao_matricula_por_dependencia AS (
WITH
urban_day
AS
(
SELECT
count
(
*
)
as
urbano_dia_total
,
ano_censo
,
estado_id
,
municipio_id
,
serie_ano_id
,
dependencia_adm_id
FROM
matricula
WHERE
localizacao_id
=
1
AND
dependencia_adm_id
IN
(
1
,
2
,
3
)
AND
(
turma_turno_id
IN
(
1
,
2
,
4
,
99
)
OR
turma_turno_id
IS
null
)
AND
WHERE
localizacao_id
=
1
AND
dependencia_adm_id
IN
(
1
,
2
,
3
)
AND
(
turma_turno_id
IN
(
1
,
2
,
4
)
OR
turma_turno_id
IS
null
)
AND
(
tipo_atendimento_turma
<=
2
OR
tipo
<=
3
)
GROUP
BY
ano_censo
,
estado_id
,
municipio_id
,
serie_ano_id
,
dependencia_adm_id
ORDER
BY
ano_censo
,
ano_censo
,
estado_id
,
municipio_id
,
serie_ano_id
,
dependencia_adm_id
),
...
...
@@ -18,7 +18,7 @@ WITH urban_day AS
rural_day
AS
(
SELECT
count
(
*
)
as
rural_dia_total
,
ano_censo
,
estado_id
,
municipio_id
,
serie_ano_id
,
dependencia_adm_id
FROM
matricula
WHERE
localizacao_id
=
2
AND
dependencia_adm_id
IN
(
1
,
2
,
3
)
AND
(
turma_turno_id
IN
(
1
,
2
,
4
,
99
)
OR
turma_turno_id
IS
null
)
AND
WHERE
localizacao_id
=
2
AND
dependencia_adm_id
IN
(
1
,
2
,
3
)
AND
(
turma_turno_id
IN
(
1
,
2
,
4
)
OR
turma_turno_id
IS
null
)
AND
(
tipo_atendimento_turma
<=
2
OR
tipo
<=
3
)
GROUP
BY
ano_censo
,
estado_id
,
municipio_id
,
serie_ano_id
,
dependencia_adm_id
ORDER
BY
ano_censo
,
ano_censo
,
estado_id
,
municipio_id
,
serie_ano_id
,
dependencia_adm_id
),
...
...
@@ -47,7 +47,7 @@ FROM matricula
LEFT
JOIN
urban_night
ON
matricula
.
ano_censo
=
urban_night
.
ano_censo
AND
matricula
.
estado_id
=
urban_night
.
estado_id
AND
matricula
.
municipio_id
=
urban_night
.
municipio_id
AND
matricula
.
serie_ano_id
=
urban_night
.
serie_ano_id
AND
urban_night
.
dependencia_adm_id
=
matricula
.
dependencia_adm_id
WHERE
matricula
.
dependencia_adm_id
IN
(
1
,
2
,
3
)
AND
matricula
.
ano_censo
>=
2018
AND
matricula
.
serie_ano_id
IS
NOT
NULL
WHERE
matricula
.
dependencia_adm_id
IN
(
1
,
2
,
3
)
AND
matricula
.
ano_censo
>=
2018
AND
matricula
.
serie_ano_id
IS
NOT
NULL
AND
turma_turno_id
<>
99
GROUP
BY
matricula
.
ano_censo
,
matricula
.
estado_id
,
matricula
.
municipio_id
,
matricula
.
dependencia_adm_id
,
etapa_ensino_escola_ano_id
,
urbano_dia_total
,
rural_dia_total
,
urbano_noite_total
,
rural_noite_total
...
...
@@ -62,3 +62,4 @@ SELECT
sum
(
rural_dia_total
),
sum
(
urbano_noite_total
),
sum
(
rural_noite_total
)
FROM
projecao_matricula_por_dependencia
GROUP
BY
ano_censo
,
estado_id
,
municipio_id
,
dependencia_adm_id
,
serie
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment