在sql查询中关于between and的问题

[复制链接]
查看11 | 回复1 | 2009-3-12 12:31:07 | 显示全部楼层 |阅读模式
为什么加了between and后比没有加使得数据统计会更大,比如我有个表s查询得出
select sum(a) from s where f between 0 and 9999 比select sum(a)from s还要大,f是最大范围
原句是
select sum(a) from s where f between 0 and 9999and c'' and k between '2007-1-1' and '2008-2-2'and t=yyy
与select sum(a) from s wherec'' and k between '2007-1-1' and '2008-2-2' and t=yyy
还有申明:尽管f为无穷大的范围还是这样,理论上结果应该一样,但是我的不是

回复

使用道具 举报

千问 | 2009-3-12 12:31:07 | 显示全部楼层
我怀疑f值有空值,语句是没问题,而且用了between条件后数据肯定也要少些的...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行