I have this code and its temporary tables so you can run it.
create table #student
(
id int identity(1,1),
firstname varchar(50),
lastname varchar(50
This should get you started:
-- filter out the student and quiz you want
DECLARE @qid INT = 1
DECLARE @sid INT = 1
SELECT *
FROM #student AS s
INNER JOIN #quiz AS q -- you want the quiz
ON 1=1
LEFT OUTER JOIN #quiz_details AS qd -- left join here to get result where rows not found
ON qd.id = q.id
AND qd.student_id=s.id
WHERE s.id = @sid
AND q.id = @qid
AND qd.id IS NULL -- only return quizes not taken