Advertisement
jzgeorge

zzz

May 4th, 2017
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. SELECT row_number() OVER ()::numeric AS idregistro,
  2. tbl_syllabus.idregistro AS idsyllabus,
  3. tbl_syllabus.id_materia,
  4. tbl_syllabus.id_periodo_academico,
  5. tbl_syllabus.codigo,
  6. tbl_syllabus.tipo_materia,
  7. tbl_syllabus.tipo_syllabus,
  8. tbl_syllabus.fecha_creacion,
  9. tbl_syllabus.id_personal_aprueba,
  10. tbl_syllabus.estado,
  11. tbl_syllabus.creditos,
  12. tbl_syllabus_docente_informacion.id_personal,
  13. tbl_syllabus_docente_informacion.email_institucional,
  14. tbl_syllabus_mallas.id_malla,
  15. tbl_syllabus_mallas.id_escuela,
  16. escuela.nombre AS nombreescuela,
  17. materia_unica.nombre AS nombremateria,
  18. malla_escuela.nombre AS nombremalla,
  19. materia_unica.iddepartamento,
  20. departamento.nombre as nombredepartamento,
  21. CASE
  22. WHEN tbl_syllabus.tipo_materia = 'CG'::text THEN ( SELECT tbl_syllabus_mu_departamentos.fecha_aprobacion
  23. FROM esq_ceac_planclase.tbl_syllabus_mu_departamentos
  24. WHERE tbl_syllabus_mu_departamentos.id_syllabus = tbl_syllabus.idregistro
  25. LIMIT 1)
  26. ELSE ( SELECT tbl_syllabus_mallas.fecha_aprobacion
  27. FROM esq_ceac_planclase.tbl_syllabus_mallas
  28. WHERE tbl_syllabus_mallas.id_syllabus = tbl_syllabus.idregistro AND tbl_syllabus_mallas.aprueba = 'S'::text
  29. LIMIT 1)
  30. END AS fecha_aprobacion
  31. FROM esq_ceac_planclase.tbl_syllabus
  32. JOIN esq_ceac_planclase.tbl_syllabus_docente_informacion ON tbl_syllabus.idregistro = tbl_syllabus_docente_informacion.id_syllabus
  33. LEFT JOIN esq_ceac_planclase.tbl_syllabus_mallas ON tbl_syllabus.idregistro = tbl_syllabus_mallas.id_syllabus
  34. left JOIN esq_ceac_planclase.tbl_syllabus_mu_departamentos ON tbl_syllabus.idregistro = tbl_syllabus_mu_departamentos.id_syllabus
  35. LEFT JOIN esq_inscripciones.escuela ON tbl_syllabus_mallas.id_escuela = escuela.idescuela
  36. LEFT JOIN esq_distributivos.materia_unica ON tbl_syllabus.id_materia = materia_unica.idmateria_unica
  37. LEFT JOIN esq_mallas.malla_escuela ON tbl_syllabus_mallas.id_malla = malla_escuela.idmalla
  38. LEFT JOIN esq_distributivos.departamento ON materia_unica.iddepartamento = departamento.iddepartamento;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement