在informix数据库中某表的isinputreport字段一共有null,空串,0和1四个字段,现在要查询非1的数据:
select * from xxx where isinputreport != '1'
结果发现查询结果不包含为null的数据!以上sql调整了一下:
select * from xxx where isinputreport != '1' or isinputreport is null;
另外在sql判空时,我们以前都是这样写的:
···
select * from tablex where field1 is null or field1 != ‘’
···
实际只需判断字段不为非空字符串,就会自动排除掉为null的数据了:
···
select * from tablex where field1 != ‘’
···