Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- View: esq_ceac_planclase.v_syllabus
- -- 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,
- tbl_syllabus_docente_informacion.email_institucional,
- 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_1.fecha_aprobacion
- FROM esq_ceac_planclase.tbl_syllabus_mu_departamentos tbl_syllabus_mu_departamentos_1
- WHERE tbl_syllabus_mu_departamentos_1.id_syllabus = tbl_syllabus.idregistro
- LIMIT 1)
- ELSE ( SELECT tbl_syllabus_mallas_1.fecha_aprobacion
- FROM esq_ceac_planclase.tbl_syllabus_mallas tbl_syllabus_mallas_1
- WHERE tbl_syllabus_mallas_1.id_syllabus = tbl_syllabus.idregistro AND tbl_syllabus_mallas_1.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,
- ' '::text AS bibliografia_b,
- ' '::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;
- GRANT ALL ON TABLE esq_ceac_planclase.v_syllabus TO ceac_analitico;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement