【问题标题】:insert into where not exists in hive插入蜂巢中不存在的地方
【发布时间】:2014-01-06 14:07:21
【问题描述】:

我需要 ansi sql 中这个等价物的 hive 语法

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

所以 tablea 不包含重复项,只插入 tableb 中的新 id。

【问题讨论】:

    标签: hadoop hive azure-hdinsight


    【解决方案1】:

    将左外连接与 tableA.id 为空的过滤器一起使用:

    insert overwrite into tableA (id)
    select b.id from tableB b left outer join tableA a
     on a.id = b.id
    where a.id is null
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-21
      • 2019-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多