插入蜂巢中不存在的位置

时间:2014-01-06 14:07:22

标签: hadoop hive hdinsight

我需要ansi sql中等效的hive语法

insert into tablea
(id)
select id 
from tableb
where id not in (select id from tablea)

因此tablea不包含重复项,只插入tableb中的新ID。

1 个答案:

答案 0 :(得分:0)

使用左外连接和tablea.id为null的过滤器:

insert overwrite into tablea (id)
select b.id from tableb b left outer join table tablea a
 on a.id = b.id
where a.id is null