热线电话:13121318867

登录
2019-07-01 阅读量: 810
Mysql中使用count加条件统计

使用count()函数实现条件统计的基础是对于值为NULL的记录不计数,常用的有以下三种方式,假设统计num大于200的记录

select count(num > 200 or null) from a;

select count(if(num > 200, 1, null)) from a

select count(case when num > 200 then 1 end) from a

66.6667
5
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子