【发布时间】:2018-10-31 11:06:20
【问题描述】:
我收到一位同事的查询,其中包含如下 where 语句:
where ...
and case
when AOS.aircft_out_of_srvc_reason_cd in ('L','H')
or AOS.mntnc_stn_cd in ('TLE','DWH') then 'Y'
else 'N' end ='N'
我想如果我把case改成下面的,我可以把它拿出来
where ...
and not ( AOS.aircft_out_of_srvc_reason_cd in ('L','H')
or AOS.mntnc_stn_cd in ('TLE','DWH'))
但这在某种程度上产生了不到原始记录数的 10%。对我来说,两者的逻辑似乎是相同的。有谁知道为什么 Teradata 以不同的方式对待他们?
【问题讨论】:
-
你能指出第一个查询选择的示例行,但第二个查询没有选择吗?
-
aircft_out_of_srvc_reason_cd和mntnc_stn_cd的任何列是否允许空值? -
OR很好。它被not (...)否定了