Hive中求交集和差集的两种方法

来源:互联网 发布:sql删除数据的语句 编辑:程序博客网 时间:2024/06/16 16:38

Hive中求交集和差集的两种方法:

--1.交集:

select id from t1 union select id from t2
select id from t1 intersect select id from t2

--2.差集
select a.id from t1 left join t2 on t2.id = t1.id and t2.id is null;
select id from t1 except select id from t2
原创粉丝点击