mysql 查空对象和非空对象
1、查询字段DesOrgCode为(NULL) 记录
SELECT * from crossalarm where DesOrgCode is null ;
//不为(NULL)
SELECT * from crossalarm where DesOrgCode is not null ;
2、查询字段DesOrgCode为 '' 记录
SELECT * from crossalarm where DesOrgCode = '' ;
//不为 ''
SELECT * from crossalarm where DesOrgCode <> '' ;
3、查询字段DesOrgCode为 '' 和 (NULL) 的记录
SELECT * from crossalarm where IFNULL(DesOrgCode,'') = ''
//不为 '' 和 (NULL)
SELECT * from crossalarm where IFNULL(DesOrgCode,'') <> ''

浙公网安备 33010602011771号