偶来个最傻的
select *
from
(
select count
from table1
order by count desc
)
where rownumselect * from students1;
ID AREA STU_TYPE
SCORE
---------------- ---------- -------- ----------------------
1 111g
80.00
1 111j
80.00
1 222g
89.00
1 222g
68.00
2 111g
80.00
2 111j
70.00
2 222g
60.00
2 222j
65.00
3 111g
75.00
3 111j
58.00
3 222g
58.00
3 222j
90.00
4 111g
89.00
4 111j
90.00
4 222g
90.00
4 222j
89.00
16 rows selected
SQL>
SQL> select w.id,w.area,w.stu_type,w.score from
2(selectt.id,t.area,t.stu_type,row_number() over(order byscore desc) rn,t.scorefrom students1 t) w
3where w.rn<=3;
ID AREA STU_TYPE
SCORE
---------------- ---------- -------- ----------------------
3 222j
90.00
4 111j
90.00
4 222g
90.00
|