Эквивалентная логика для этого:
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'
по существу:
where . . . and
AOS.aircft_out_of_srvc_reason_cd not in ('L', 'H') and
AOS.mntnc_stn_cd not in ('TLE', 'DWH')
(что совпадает с вашим not
выражением)
Единственноепроблема в том, если оба столбца NULL
, поэтому вы должны включить:
where . . . and
( (AOS.aircft_out_of_srvc_reason_cd not in ('L', 'H') and
AOS.mntnc_stn_cd not in ('TLE', 'DWH') and
) or
(AOS.aircft_out_of_srvc_reason_cd is null and AOS.mntnc_stn_cd is null)
)