使用 IS NOT NULL 可以去除空值
比如
select * from table where value1 <> 'test' and value2 IS NULL
即可
其中<> 表示不等于
先用数据库函数进行null值转换再比较:
SELECT * from 表
where not isnull(字段3,'0') = D
还有很多搭配方式,1.where
字段3
!=
d
2.where
字段3 <>
d
3.加个条件
and
字段2
is
null
sqlserver:
SELECT * from 表
where isnull(字段3,'') <> 'D'
oracle:
SELECT * from 表
where nvl(字段3,'') <> 'D'
mysql:
SELECT * from 表
where ifnull(字段3,'') <> 'D'
SELECT * from 表
where 字段3 != D