首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql判断数据某列空值有关问题 0.0

2012-02-13 
sql判断数据某列空值问题 0.0我的 sql :select * from servicesbill where UserId169 and servicesstate

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,'')>'' ) )
[解决办法]
探讨
我想 查询 servicesstate=2 并且remark !='' 的数据 和 servic……

[解决办法]
SQL code
select * from servicesbill where UserId=169 and (servicesstate=3 or (servicesstate=2 and (isnull(remark,'')>'' ) )
[解决办法]
SQL code
isnull(remark,'')<>'' 

热点排行