I have the following column
RA COD_CADASTRO COD_TURMA SEMESTRE SITUACAO
---------- --------------------------------------- ---------- ---------- ---------------
917606337 2 10 1 CURSANDO
917606338 5 20 3 TRANCADO
917606339 4 30 2 DESISTENTE
917606340 3 40 5 CURSANDO
917606341 9 1 CURSANDO
And this pivot
SITUACAO 1 2 3 4 5
--------------- ---------- ---------- ---------- ---------- ----------
TRANCADO 0 0 1 0 0
CURSANDO 2 0 0 0 1
DESISTENTE 0 1 0 0 0
select * from (select RA, SITUATION, SEMESTER from ALUNO) A pivot (count (RA) for SEMESTRE in (1, 2, 3, 4, 5)) B
I would like to know how to create a total column just after the situation column totaling the number of students with the course locked, attending and quitting independent of the semester
In case it would be
Trancado 1
Cursando 3
Desistente 1