0

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.

4

1 回答 1

1

您似乎正试图将具有多个空行的 SQL 语句复制并粘贴到 SQL*Plus 中。如果是这样,您要么需要在复制和粘贴之前删除空行,要么需要set sqlblanklines on在粘贴包含空行的查询之前在 SQL*Plus 中运行 SQL*Plus 命令。

于 2012-10-10T19:26:14.457 回答