求这个查询条件要怎么写。。。
数据库中有Status,DateOfPost这两个字段需要当做查询条件来查询,
这两个字段中的数据类型都为nvarchar,并且是可以为空的,
现在这两个字段中包含3类数据:“正常数据”,“空字符串”,“NULL”,
现在我想查询,表中这两列没有数据的列查询出来,请问这个条件要怎么写?
[最优解释]
where isnull(Status,'')='' and isnull(DateOfPost,'')=''
[其他解释]
select * from 表 where rtrim(isnull(字段,''))=''
[其他解释]
SELECT *
FROM 表
WHERE (Status IS NULL OR Status='') AND (DateOfPost IS NULL OR DateOfPost='')
[其他解释]
没有数据仅仅是指null而不是空字符串吧?
[其他解释]
where isnull(Status,'')='' and isnull(DateOfPost,'')=''
[其他解释]
where isnull(Status,'')='' and isnull(DateOfPost,'')=''
还是
where isnull(Status,'')='' or isnull(DateOfPost,'')=''
管他是空字符串还是null,先都整成' '
你自己选一个吧
[其他解释]
where Status is null and DateOfPost is null
[其他解释]
NULL是没有数据,空字符串也是没有数据啊。。。。