update query

This commit is contained in:
Pavel 2024-03-28 13:35:38 +03:00
parent 416edf5094
commit afb94fcb49

@ -282,7 +282,18 @@ WHERE privilege_name = $2
AND (amount < $3 OR created_at <= NOW() - INTERVAL '1 month');
-- name: GetAllAnswersByQuizID :many
SELECT DISTINCT ON(question_id) content, created_at, question_id, id FROM answer WHERE session = $1 AND start = false ORDER BY question_id ASC, created_at DESC;
SELECT DISTINCT ON (a.question_id)
a.content, a.created_at, a.question_id, a.id, q.questiontype, quiz.qid
FROM
answer a
JOIN
question q ON a.question_id = q.id
JOIN
quiz ON q.quiz_id = quiz.id
WHERE
a.session = $1 AND a.start = false AND a.deleted = false
ORDER BY
a.question_id ASC, a.created_at DESC;
-- name: InsertAnswers :exec
INSERT INTO answer(
content,