문제

I need the hive syntax for this equivalent in ansi sql

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

so tablea contains no duplicates and only new ids from tableb are inserted.

도움이 되었습니까?

해결책

Use left outer join with a filter that the tableA.id is null:

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top