select aa.cd_perd_letv as PeriodoLetivo, o.nm_org as OrgaoOfertante, cc.nm_ident_compnt_curr as IdComponente, cc.nm_compnt_curr as NomeComponente, t.nm_ident_turma as Turma, count(*) as QteMatriculados from siga_atividade_academica aa, siga_componente_curricular cc, siga_turma t, siga_orgao o, siga_matricula_turma mt where aa.cd_compnt_curr=cc.cd_compnt_curr and aa.cd_ativ_acad=t.cd_ativ_acad and aa.cd_org=o.cd_org and aa.cd_perd_letv in ('2014.1','2014.2') -- Alterar Ano Base and mt.cd_turma=t.cd_turma and mt.nu_sit_matr_turma=1 and not exists (select 9 from siga_docnt_turma dt where dt.cd_turma=t.cd_turma) --and o.cd_tp_org in (2,63,14) --graduacao and o.cd_tp_org in (9,42) --pos-graduacao --and o.cd_org<>201 group by aa.cd_perd_letv, o.nm_org, cc.nm_ident_compnt_curr, cc.nm_compnt_curr, t.nm_ident_turma order by aa.cd_perd_letv, o.nm_org, cc.nm_compnt_curr, t.nm_ident_turma