+ -
当前位置:首页 → 问答吧 → 怎么实现:统计表内为空的次数?

怎么实现:统计表内为空的次数?

时间:2011-11-24

来源:互联网

一个表格里面,其中有两列为表示日期时间,但其中有些行没有数据,为空(NULL)

如何统计这两行内为空(NULL)的次数,以及这两行同时为空(NULL)的次数?

如下图所示:
表1.jpg(118.01 KB)

2011-11-24 13:23

表2.jpg(9.85 KB)

2011-11-24 13:23

作者: jphn   发布时间: 2011-11-24

select count(*) from table where col is null or col2 is null

select count(*) from table where col is null and col2 is null

作者: oswica   发布时间: 2011-11-24