因为count统计语句是统计不出null的,所以用
select count(address) from test where address is null
得出的结果一定是0,知道了原因,相应的解决办法就有了,可以统计不为空的列,假如name列不可以为空,每一行都有数据,那么可以用下面的语句来查询
select count(name) from test where address is null and name is not null
--计算为null的个数
select count(*) from table where address is null
--计算长度为0的个数
select count(*) from table where address=''
--计算为null或长度为0的个数
select count(*) from table where address='' or address is null
首先你要说清楚是空字符还是无值。
空字符:address=‘’
无值:address is null
都算就加or关系
is dbnull
where address=''