I have the following sql statement:
SELECT a.alunonome AS aluno,
m.materianome AS disciplina,
AVG(CASE n.notabimestre
WHEN 1 THEN n.nota
ELSE null
END) AS bim1,
AVG(CASE n.notabimestre
WHEN 2 THEN n.nota
ELSE null
END) AS bim2,
AVG(CASE n.notabimestre
WHEN 3 THEN n.nota
ELSE null
END) AS bim3,
AVG(CASE n.notabimestre
WHEN 4 THEN n.nota
ELSE null
END) AS bim4
FROM notas n
INNER JOIN materias m ON m.materiaid = n.materiaid
INNER JOIN alunos a ON a.alunoid = n.alunoid
GROUP BY n.materiaid, n.alunoid, a.alunonome, m.materianome
It returns me:
How do I concatenate the id of the note thus:
ALUNO |DISCIPLINA |id1|bim1|id2|bim2|id3|bim3|id4|bim4
GUSTAVO |BANCO DE DADOS |1 |7 |2 |7 |3 |7 |4 |8
id of the note and in front of the note do this for the 4 bimestres. Thank you!