0
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 that result:
Now I need to take the student’s various responses and compare them to generate a table with his average.
Example:
RA | Student | Average
111 | So-and-so | 5
I’ve tried comparing the AR’s (which are unique identifiers), storing the same ones in an array and then comparing the answers, but it didn’t work, because it’s not saving the same students in this array.
NOTE: The amount of student responses may vary, so each student may have 1 to 5 responses depending on the subject, but in a query, there will always be the same number of responses per student.
Can someone help me and shed some light on how I can do this?
Can you post the table structures? one way to get what you want is to make a COUNT where answer student = correct answer, grouped by ra, and then another COUNT to see how many answers each student gave. Ai later vc divide these 2 Counts and say the note.
– William Bruno Rocha Moraes
@Williambrunorochamoraes This is the structure of the table: http://i.imgur.com/muNqst9.png
– Diogo Lopes