Possible Duplicate:
Top n percent top n%
SQL> select ssn, gpa from (select ssn, gpa,
rank() over(partition by ssn order by gpa desc) as rank,
count(*) over(partition by ssn) as no_students
SQL> from students_gpa)
Error
*
ERROR at line 1: ORA-00936: missing expression
I am trying to get the top 5% of students with a GPA of 4. Since I have two students with a GPA of 4, I want to report both students and not just one one 1 student who occupies the first row. Any help will be appreciated.