Предполагается, что по крайней мере SQL Server 2005 для CTE :
declare @Test table (
course char(4),
section char(3),
grade char(2),
gradeCount int
)
insert into @Test
values ('1301','001','A',100),
('1301','002','A',20),
('1301','001','B',10),
('1301','002','B',50),
('1301','003','B',50)
;with cteMaxGradeCount as (
select grade, max(gradeCount) as MaxGradeCount
from @Test
group by grade
)
select t.course, t.SECTION, t.grade, t.gradeCount
from cteMaxGradeCount c
inner join @Test t
on c.grade = t.grade
and c.MaxGradeCount = t.gradeCount
order by t.grade