hive不等於會過濾掉null值
解決辦法:
select distinct so_type
from dwd_invoice_from_2021_10_01_two_week_inv
where dt = '2023-05-03'
and nullif('1',so_type) != 'G2';
AND nvl(so_type, '') not in ('G2','RE');
或者
select *
from dwd_invoice_from_2021_10_01_two_week_inv
where dt = '2023-05-03'
and so_type is null
or (
so_type != 'G2'
and so_type != 'RE'
);