Get the top row after order by in Oracle Subquery

前端 未结 4 1584
一整个雨季
一整个雨季 2021-02-15 17:19

I have a table student(id, name, department, age, score). I want to find the youngest student who has the highest(among the youngest students) score of each department. In SQL S

4条回答
  •  春和景丽
    2021-02-15 18:01

    In addition to Allan's answer, this works fine too:

    select * 
    from (SELECT * 
      FROM student
      order by age asc, 
               score desc) 
    where rownum = 1;
    

提交回复
热议问题