Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. /* combo cursos com matricula no ano */
  2. SELECT
  3. ec.curso_cod AS id,
  4. ec.curso_descricao
  5. FROM edu_curso ec
  6.  
  7. INNER JOIN edu_nivel_ensino ene
  8. ON ec.curso_nivenscod = ene.nivens_cod
  9.  
  10. INNER JOIN edu_classe ecl
  11. ON ec.curso_cod = ecl.classe_cursocod
  12. AND ecl.classe_ano = :ANO
  13.  
  14. INNER JOIN edu_matricula em
  15. ON ecl.classe_cod = em.matric_classecod
  16.  
  17. INNER JOIN edu_matricula_status ems
  18. ON em.matric_cod = ems.matricst_matriccod
  19. AND ems.matricst_ativo = 1
  20. -- opcional para filtrar status especificos, caso nao tenha lista todos os status
  21. AND ems.matricst_status IN (:MATRICULA_STATUS)
  22.  
  23. GROUP BY
  24. ec.curso_cod,
  25. ec.curso_descricao,
  26. ene.nivens_ordem
  27.  
  28. ORDER BY
  29. ene.nivens_ordem,
  30. ec.curso_descricao
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement