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

SQL2000查询视图的疑义

2013-12-15 
SQL2000查询视图的疑问SQL2000查询视图的疑问查询如下视图字段SELECT viptraderid, MaterialID, LLqcqty,

SQL2000查询视图的疑问
SQL2000查询视图的疑问

查询如下视图字段
SELECT viptraderid, MaterialID, LLqcqty, LLsrqty, llfcqty, lljcqty, Code
FROM dbo.vip_lljgsfczhbb

112.0000000000.0000000000.0000000000.00000000001010001                                                         
41114.0000000000.0000000000.0000000000.00000000005010004                                                         
4132599.0000000000.0000000000.000000000099.00000000001060030                                                         
58112.0000000000.0000000000.0000000000.00000000005010002                                                         
58116.0000000000.0000000000.0000000000.00000000005010006                                                         
58364.0000000000.0000000000.0000000000.00000000004010016                                                         
58365.0000000000.0000000000.0000000000.00000000004010017                                                         

1/为什么如下语句查询不到内容呢?  ()
SELECT viptraderid, MaterialID, LLqcqty, LLsrqty, llfcqty, lljcqty, Code
FROM dbo.vip_lljgsfczhbb
where  LLqcqty<>0   and   LLsrqty<>0  and  llfcqty<>0  and   lljcqty<>0



2/为什么如下查询却可以正常查询到结果
SELECT viptraderid, MaterialID, LLqcqty, LLsrqty, llfcqty, lljcqty, Code
FROM dbo.vip_lljgsfczhbb
where  LLqcqty=0   and   LLsrqty=0  and  llfcqty=0  and   lljcqty=0
112.0000000000.0000000000.0000000000.00000000001010001                                                         
41114.0000000000.0000000000.0000000000.00000000005010004                                                         
58112.0000000000.0000000000.0000000000.00000000005010002                                                         
58116.0000000000.0000000000.0000000000.00000000005010006                                                         
58364.0000000000.0000000000.0000000000.00000000004010016                                                         
58365.0000000000.0000000000.0000000000.00000000004010017                                                         



[解决办法]
做了一个实验,你可以看看:

select case when .0000000000 = 0 then '相等' else '不相等' end
/*
相等
*/ 

热点排行