求班级最大、最小、平均分,以及查过平局分人数
select z.*,m.sl from
(SELECT classno,max(grade),min(grade),avg(grade) FROM STSCORE group by classno) z
left join
(select classno,count(*) as sl from
(select a.*,b.pj from STSCORE a left join
(SELECT classno,avg(grade) as pj FROM STSCORE group by classno) b on a.classno=b.classno) where grade>pj group by classno) m on z.classno=m.classno