Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- DROP VIEW esq_ceac_planclase.v_syllabus_materia_departamento;
- CREATE OR REPLACE VIEW esq_ceac_planclase.v_syllabus_materia_departamento AS
- SELECT row_number() OVER ()::numeric AS idregistro,
- tbl_syllabus.idregistro AS idsyllabus,
- tbl_syllabus.id_materia,
- tbl_syllabus.id_periodo_academico,
- tbl_syllabus.codigo,
- tbl_syllabus.tipo_materia,
- tbl_syllabus.estado,
- concat(tbl_syllabus_docente_informacion.apellido1, ' ', tbl_syllabus_docente_informacion.apellido2, ' ', tbl_syllabus_docente_informacion.nombres) AS nombredocente,
- tbl_syllabus_docente_informacion.email_institucional,
- materia_unica.iddepartamento,
- materia_unica.nombre AS nombreasignatura,
- departamento.nombre AS nombredepartamento,
- periodo_academico.nombre AS nombreperiodo,
- tbl_syllabus.fecha_creacion,
- tbl_syllabus.tipo_syllabus,
- tbl_syllabus.id_personal_aprueba,
- CASE
- WHEN tbl_syllabus.tipo_materia = 'CG'::text THEN ( SELECT tbl_syllabus_mu_departamentos.fecha_aprobacion
- FROM esq_ceac_planclase.tbl_syllabus_mu_departamentos
- WHERE tbl_syllabus_mu_departamentos.id_syllabus = tbl_syllabus.idregistro
- LIMIT 1)
- ELSE ( SELECT tbl_syllabus_mallas.fecha_aprobacion
- FROM esq_ceac_planclase.tbl_syllabus_mallas
- WHERE tbl_syllabus_mallas.id_syllabus = tbl_syllabus.idregistro AND tbl_syllabus_mallas.aprueba = 'S'::text
- LIMIT 1)
- END AS fecha_aprobacion
- FROM esq_ceac_planclase.tbl_syllabus
- JOIN esq_ceac_planclase.tbl_syllabus_docente_informacion ON tbl_syllabus.idregistro = tbl_syllabus_docente_informacion.id_syllabus
- JOIN esq_distributivos.materia_unica ON tbl_syllabus.id_materia = materia_unica.idmateria_unica
- JOIN esq_distributivos.departamento ON materia_unica.iddepartamento = departamento.iddepartamento
- JOIN esq_periodos_academicos.periodo_academico ON tbl_syllabus.id_periodo_academico = periodo_academico.idperiodo;
- ALTER TABLE esq_ceac_planclase.v_syllabus_materia_departamento
- OWNER TO ceac_analitico;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement