i have a Postgres SQL database that has quizes, questions, answers and marks on there (multiple tables) im trying to write a query to work out the maxscore for one quiz and then update the quiz table using the query thats just calculated the max score
Heres my querys
SELECT SUM( maxscore)
FROM (
SELECT max(answer.answermark) AS maxscore
FROM answer, questions
WHERE questions.quizid = 1 AND answer.questionid = questions.questionid
GROUP BY answer.questionid
) scr;
UPDATE quiz
SET maxscore = '50'
WHERE quizid = 1
where "SET maxscore = '50'
" i need to instead of typing 50 i need to use the calculation from the query above, is there any way ??
Thanks