select SNO from (select SNO, sum(case subject when'语文&(8803)#39; then score else null end) as chinese_score, sum(case subject when'数学&(8804)#39; then score else null end) as math_score from t group by SNO ) as tt where tt.chinese_score>=60 and tt.math_score<60 ===================================== 如果是case subject ……else 0的话结果就会多了一个1002