错误写法:
select count(sc.score>6) from stu_score sc
正确写法:
1:
select count(num > 200 or null) from a;
2:
select count(if(num > 200, 1, null)) from a
3:
select count(case when num > 200 then 1 end) from a
4:
select sum(if(num > 200, 1, null)) from a
5:
select sum(case when num > 200 then 1 end) from a
写的很好,转载链接
https://blog.csdn.net/albertsh/article/details/90736859