sql判断数据某列空值问题 0.0
我的 sql :
select * from servicesbill where UserId=169 and servicesstate=3 or (servicesstate=2 and remark !='' )
可是 remark 列 空值 还是被查出来了、、、 这个怎么办啊?
我想 查询 servicesstate=2 并且remark !='' 的数据 和 servicesstate=3 的数据
[解决办法]
- SQL code
select * from servicesbill where UserId=169 and servicesstate=3 or (servicesstate=2 and isnull(remark,'') !='' )
[解决办法]
- SQL code
select * from servicesbill where UserId=169 and servicesstate=3 or (servicesstate=2 and remark !='' and remark is not null)
[解决办法]
- SQL code
select * from servicesbill where UserId=169 and (servicesstate=3 or (servicesstate=2 and isnull(remark,'') !='' ))
[解决办法]
- SQL code
select * from servicesbill where UserId=169 and (servicesstate=3 or (servicesstate=2 and (isnull(remark,'')>'' ) )
[解决办法]
[解决办法]
- SQL code
select * from servicesbill where UserId=169 and (servicesstate=3 or (servicesstate=2 and (isnull(remark,'')>'' ) )
[解决办法]
- SQL code
isnull(remark,'')<>''