帮助AND&而不是结果 [英] Help with AND & AND NOT results
本文介绍了帮助AND&而不是结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行时:
WHERE (VT_TR.QID = 'D')
AND (VT_TR.AP_DATE < CURRENT_DATE - 1)
AND (VT_TR.CITY = 'WPG' AND VT_TR.WFR = 'C')
返回两行预计 WFR = C
和 CITY = WPG
但是当我改变时:
It returns two rows as expected where WFR = C
and CITY = WPG
But when I change:
AND NOT ( VT_TR.CITY = 'WPG' AND VT_TR.WFR = 'C')
我希望它排除相同的两行,而不是用以下内容排除任何内容:
WFR = C
和 CITY为空
或
WFR = C
和 CITY = WPG
为什么会这样?
I would expect it to exclude the same two rows, instead it seems to be excluding anything with:
WFR = C
and CITY is null
or
WFR = C
and CITY = WPG
Why would this be?
推荐答案
您应该阅读本文以了解与Null比较的三值逻辑的SQL实现: SQL中的无效 [ ^ ]
You should read this to understand the SQL implementation of three-valued logic in comparisons with Null: Null in SQL[^]
这篇关于帮助AND&而不是结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文