I have the following sql statement:
Select
Notas.NotaID,
Materias.MateriaNome,
Alunos.AlunoNome,
Alunos.AlunoID,
max(case when NotaBimestre = 1 then Nota else null end) as 1bim,
max(case when NotaBimestre = 2 then Nota else null end) as 2bim,
max(case when NotaBimestre = 3 then Nota else null end) as 3bim,
max(case when NotaBimestre = 4 then Nota else null end) as 4bim
From ((notas
INNER JOIN Materias
ON Notas.MateriaID = Materias.MateriaID)
INNER JOIN Alunos
ON Notas.AlunoID = Alunos.AlunoID)
group by (NotaID)
Result:
How do I stay in this pattern:
ID | ALUNO | DISCIPLINA | 1BIM| 2BIM | 3BIM | 4BIM
16 | NATANAEL | BANCO DE DADOS | 8 | | |
17 | GUSTAVO | PROGRAMAÇÃO PARA WEB | 9.5 | 8 | 8.5 | 10