E-265618
SSC Journeyman
Points: 91
More actions
October 10, 2005 at 9:21 pm
#165813
Given a table (STUDENT) that contains two fields:
Write a single SELECT query using only standard SQL (i.e. don't use Top N or another platform specific predicates) that returns the name and score for the top 5 students.
Padmaja Kundrapu
Old Hand
Points: 323
October 10, 2005 at 11:14 pm
#596437
SELECT a.stname, a.score FROM student a WHERE (SELECT COUNT (DISTINCT (b.score)) FROM student b WHERE a.score<=b.score) BETWEEN 1 AND 5
ORDER BY a.score DESC
I think this is the required solution.
Regards
Padmaja
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply