select grade from (select grade,sum(number)over(order by grade) a,sum(number)over(order by grade desc) b from class_grade) t where a>=(select sum(number)/2 from class_grade) and b>=(select sum(number)/2 from class_grade) order by grade
select grade from (select grade,sum(number)over(order by grade) a,sum(number)over(order by grade desc) b from class_grade) t where a>=(select sum(number)/2 from class_grade) and b>=(select sum(number)/2 from class_grade) order by grade