query to get the student details who has got highest total marks in Half-Yearly exam

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 310
SELECT Top 1 SUM(Marks) TotalMarks, M.STUDENT_ID, S.STUDENT_NAME, S.CLASS
FROM Student_Marks M
JOIN STUDENT S ON S.STUDENT_ID=M.STUDENT_ID
WHERE M.EXAM_ID = ( SELECT EXAM_ID FROM SUBJECT_EXAM where EXAM_NAME = 'Half-yearly')
GROUP BY M.STUDENT_ID , S.STUDENT_NAME, S.CLASS
ORDER BY TotalMarks DESC

Comments or Responses

Login to post response