left join的一个奇怪问题
语句1:select count(*)
from v_gzjbwl_fund_amabzzpay a
left join v_gzjbwl_fund_amabzzbankroll b on (a.member_code = b.member_code and a.fund_billnum = b.fund_billnum
and (b.dd_type_settlement <> '承兑汇票' or b.dd_type_settlement <> '商业承兑汇票')
and b.fund_billnum is not null);
语句2:
select count(*)
from v_gzjbwl_fund_amabzzpay a
left join v_gzjbwl_fund_amabzzbankroll b on (
(b.dd_type_settlement <> '承兑汇票' or b.dd_type_settlement <> '商业承兑汇票') and
a.member_code = b.member_code and a.fund_billnum = b.fund_billnum
and b.fund_billnum is not null);
结果分别为:
906040
822
不知道为什么。。。
------解决方案--------------------http://topic.csdn.net/u/20120807/14/0d9e9941-45cf-4ddd-b11b-e8b7a2c576ea.html
留意下他们的回帖,估计没结果,呵呵
------解决方案--------------------
条件错误:
nvl(b.dd_type_settlement,'') not in ('承兑汇票','商业承兑汇票')
等价于
(b.dd_type_settlement <> '承兑汇票' and b.dd_type_settlement <> '商业承兑汇票')
呵呵 悲剧了。。。。