I am having difficulty writing a Stored Procedure that will query a list of students with their associative marks.
Retrieving a List of Students - trivial Retrieving the top five marks per student - trivial...SELECT TOP (5) * WHERE StudentID = X
Combining these two, I am a bit confused.
I would like the Stored Procedure to return two tables:
- First table that lists students by a criteria
- Second table: a list of grades (5 each per student in the First Table)
Second table is when it is tricky. I can get all the marks per student in First Table but not sure how I can limit it to top 5.