//你先试试看看,我还没来得及调试
表scores
StuName char(20),
S1 numeric,
S2 numeric,
S3 numeric,
S4 numeric,
S5 numeric,
S6 numeric
select count(a.*) from score a ,
(selct StuName,(case when s1<60 then
1 else
0 end)+
(case when s2<60 then
1 else
0 end)+
(case when s3<60 then
1 else
0 end)+
(case when s4<60 then
1 else
0 end)+
(case when s5<60 then
1 else
0 end)+
(case when s6<60 then
1 else
0 end) as under60,
from score
order by StuName) as b
where a.StuName=b.StuName and b.under60=2 and (a.s1+a.s2+a.s3+a.s4+a.s5+a.s6>360)