Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP VIEW esq_ceac_planclase.v_syllabus;
- CREATE OR REPLACE VIEW esq_ceac_planclase.v_syllabus 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.id_programa_analitico,
- tbl_syllabus.tipo_materia,
- tbl_syllabus.tipo_syllabus,
- tbl_syllabus.fecha_creacion,
- tbl_syllabus.id_personal_aprueba,
- tbl_syllabus.estado,
- tbl_syllabus.creditos,
- tbl_syllabus_docente_informacion.id_personal,
- (SELECT personal.apellido1|| ' ' ||personal.apellido2 || ' ' || personal.nombres from esq_datos_personales.personal where personal.idpersonal = tbl_syllabus.id_personal_aprueba ) as nombreaprueba,
- tbl_syllabus_docente_informacion.email_institucional,
- esq_ceac_planclase.tbl_syllabus_docente_informacion.titulo_cuarto_nivel,
- tbl_syllabus_mallas.id_malla,
- tbl_syllabus_mallas.id_escuela,
- escuela.nombre AS nombreescuela,
- materia_unica.nombre AS nombremateria,
- malla_escuela.nombre AS nombremalla,
- materia_unica.iddepartamento,
- departamento.nombre as nombredepartamento,
- 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,
- concat(tbl_syllabus_docente_informacion.apellido1, ' ', tbl_syllabus_docente_informacion.apellido2, ' ', tbl_syllabus_docente_informacion.nombres) AS nombre_docente,
- ( SELECT array_to_string(array_agg(concat(bbl.autor, ', ', bbl.titulo, ', ', bbl.anio, '.')), '|<BR>'::text) AS bibliografia_b
- FROM esq_ceac_planclase.tbl_programas_bibliografias bbl
- WHERE bbl.idprograma = tbl_syllabus.id_programa_analitico AND bbl.tipo ~~ '%B%'::text) AS bibliografia_b,
- ( SELECT array_to_string(array_agg(concat(bbl.autor, ', ', bbl.titulo, ', ', bbl.anio, '.')), '|<BR>'::text) AS bibliografia_c
- FROM esq_ceac_planclase.tbl_programas_bibliografias bbl
- WHERE bbl.idprograma = tbl_syllabus.id_programa_analitico AND bbl.tipo ~~ '%C%'::text) AS bibliografia_c
- FROM esq_ceac_planclase.tbl_syllabus
- JOIN esq_ceac_planclase.tbl_syllabus_docente_informacion ON tbl_syllabus.idregistro = tbl_syllabus_docente_informacion.id_syllabus
- LEFT JOIN esq_ceac_planclase.tbl_syllabus_mallas ON tbl_syllabus.idregistro = tbl_syllabus_mallas.id_syllabus
- left JOIN esq_ceac_planclase.tbl_syllabus_mu_departamentos ON tbl_syllabus.idregistro = tbl_syllabus_mu_departamentos.id_syllabus
- LEFT JOIN esq_inscripciones.escuela ON tbl_syllabus_mallas.id_escuela = escuela.idescuela
- LEFT JOIN esq_distributivos.materia_unica ON tbl_syllabus.id_materia = materia_unica.idmateria_unica
- LEFT JOIN esq_mallas.malla_escuela ON tbl_syllabus_mallas.id_malla = malla_escuela.idmalla
- LEFT JOIN esq_distributivos.departamento ON materia_unica.iddepartamento = departamento.iddepartamento;
- ALTER TABLE esq_ceac_planclase.v_syllabus
- OWNER TO ceac_analitico;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement