返回NULL值的记录
表p
id 字段1 字段2
1 a ……
2 b ……
3 c ……
4 null ……
select * from a where 字段1 <> 'c '
结果只返回第1、2条记录,如何让第4条null值的记录也返回。
要求不要改数据。
[解决办法]
select * from a where 字段1 <> 'c ' or 字段1 is null
[解决办法]
select * from a where 字段1 <> 'c '
union all
select * from a where 字段1 is null
[解决办法]
select * from a where isnull(字段1, 'a ') <> 'c '