-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfidegar-mar.sql
More file actions
61 lines (59 loc) · 2.46 KB
/
fidegar-mar.sql
File metadata and controls
61 lines (59 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
DELETE FROM W00A_FIDEGAR_REVALIDA;
select
vista.CURP
, vista.NOMBRES
, vista.primerapellido as PRIMER_APELLIDO
, vista.segundoapellido as SEGUNDO_APELLIDO
, vista.CCT
, vista.niveleducativo as NIVEL_EDUCATIVO
, DECODE(GRADO
,1,'PRIMERO'
,2,'SEGUNDO'
,3,'TERCERO'
,4,'CUARTO'
,5,'QUINTO'
,6,'SEXTO'
,vista.grado
) as GRADO
--, trim(vista.nombreescuela) as NOMBRE_PLANTEL
, vista.TURNO
--, vista.SERVICIOEDUCATIVO as SERVICIO_EDUCATIVO
, vista.alcaldia_cct as ALCADIA
, current_timestamp as fh_consulta
, vista.fh_carga, vista.fh_ejecucion
, 'INSCRITO' as STATUS
from MATRICULA.mview_alumnos_20212022 vista
where curp in (select curp from W00A_FIDEGAR_REVALIDA)
-- and substr(CCT,3,1) != 'P'
;
select
SAL_CURP_ALUMNO as CURP
, SAL_NOMBRE_ALUMNO as NOMBRE
, CASE WHEN SAL_PRIMER_APELLIDO is null THEN 'NULO' ELSE SAL_PRIMER_APELLIDO END as PRIMER_APELLIDO,
SAL_SEGUNDO_APELLIDO as SEGUNDO_APELLIDO
, SIS_SES_CCT_ESCUELA as CCT
--, trim(bdunica.nombre) as NOMBRE_PANTEL
, REGEXP_REPLACE(tur.des_turno,'( ){2,}', ' ') as TURNO
, CASE WHEN SNE_DESCCRIPCION_LARGA_NIVEL = 'INICIAL LACTANTES' THEN 'LACTANTE'
ELSE SNE_DESCCRIPCION_LARGA_NIVEL END as NIVEL
,DECODE(sis_sge_cve_grado_escolar
,1,'PRIMERO'
,2,'SEGUNDO'
,3,'TERCERO'
,4,'CUARTO'
,5,'QUINTO'
,6,'SEXTO'
,sis_sge_cve_grado_escolar
) as GRADO
--, del.descripcion as ALCALDIA
from SED_ALUMNOS left JOIN MATRICULA.sed_inscripciones
on sed_alumnos.sal_curp_alumno = matricula.sed_inscripciones.sis_sal_curp_alumno
and matricula.sed_inscripciones.sis_firma_digital = 1
left join MATRICULA.sed_niveles_escolares on SIS_SNE_CVE_NIVEL_ESCOLAR = SNE_CVE_NIVEL_ESCOLAR
left join bdunica.cct bdunica on matricula.sed_inscripciones.sis_ses_cct_escuela = bdunica.cct
-- left join bdunica.cve_delegacion del on bdunica.cod_municipio = del.cve_dele
left join bdunica.turno tur on bdunica.cod_turno = tur.cod_turno
where SIS_SCE_CVE_CICLO_ESCOLAR = '2021-2022'
and SAL_CURP_ALUMNO in (select curp from W00A_FIDEGAR_REVALIDA)
and substr(SIS_SES_CCT_ESCUELA,3,1) != 'P'
;