[Hive]求两个集合的减集

来源:互联网 发布:fc2视频域名更改 编辑:程序博客网 时间:2024/06/01 07:38

hive中不支持not in的写法,但是可以通过left outer join来替代

写法如下:

select a.* from (select * from rpt_pms_continue where category_level_flag='末级类目' and cart_tracker_id is not null and ds='2015-01-08' ) a left outer join (select * from pms.cross_sale_path where ds='2015-01-08' and rcmd_algorithm_id in (419,420,580,581,582,650,950,1331,1655,1656,1657,1658,1659,1660,1690,1691,1950,1951)) b on (a.cart_tracker_id=b.cart_track_id) where b.cart_track_id is null;

1 0