2014-01-06 96 views
0

不存在我需要爲這個相當於ANSI SQL插入到其中蜂巢

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

蜂巢語法,因此表A中沒有重複,並從表B只新的ID插入。

回答

0

使用左外帶有過濾器的tablea.id是空聯接:

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