前20名:
select Top20 AVG(科目1),AVG(科目2) From 表 where 年级=? order by 总成绩 DESC
后10名:
select Top10 AVG(科目1),AVG(科目2) From 表 where 年级=? order by 总成绩
剩余的:
select AVG(科目1),AVG(科目2) From 表 where 年级=? and
((not(总成绩 in(select Top20 AVG(科目1),AVG(科目2) From 表 where 年级=? order by 总成绩 DESC)) and (not(select Top10 AVG(科目1),AVG(科目2) From 表 where 年级=? order by 总成绩)))
select Average(score) From stuTable where (id Not In(Select top 20 id From stuTable Order By
Score)and(id not In(Select top 10 id From stuTable Order By score Desc))