select BB.科目,BB.rk,BB.姓名,BB.分数 from (select B.*, rank() over(partition by B.科目 order by B.分数 desc) rk from B )BB where BB.rk < 4;oracle 10g 已经测试。