Personal I have the following query:
SELECT p.ra, p.nomealuno,
qa.respostaaluno, q.respostacorreta
FROM prova p
INNER JOIN questoes_aluno qa
ON qa.idprova = p.id
INNER JOIN questao q
ON q.id = qa.idquestao
AND q.iddisciplina = 46
ORDER BY p.id ASC;
And it generates this result:
NowIneedtogetthestudent'svariousanswersandcomparethemtogenerateatablewithhisaverage.
Example:
RA|Student|Average
111|Fulano|5
IhavetriedtocomparetheRA's(whichareuniqueidentifiers),savetheequalsinanarrayandthencomparetheanswers,butitdidnotwork,becauseitisnotsavingthesamestudentsinthisarray.
NOTE:Thenumberofstudentresponsescanvary,soeachstudentcanhave1to5answersdependingonthesubject,butinaquery,therewillalwaysbethesamenumberofresponsesperstudent.
Tablelayout:
Can anyone help me and give me a glimpse of how I can do this?