StudentId QuestionId Incorrect Unanswered Flagged pace id SubtopicId
==========================================================================
1 1 1 0 0 2 1 1
1 1 0 0 0 4 2 1
1 2 0 0 0 8 3 1
I have this table with the above values in it. I want to select all the the questions attempted by a student for a particular subtopic only once. In case there are multiple entries for a question i want to select the one with the greater id. I couldn't figure out a way to select the question with the greater id. This is what i am trying.
SELECT QuestionId
, pace
, id
From table
where StudentId = 1
and SubtopicId = 1
Group
By QuestionId
Order
BY id desc;
Can anyone please tell me the modifications in my query or suggest a new one?