2014-12-09 4 views
-1

두 개의 테이블이 같은 열을 가지고 있고 테이블 1과 테이블 2의 모든 레코드를 포함하는 세 번째 테이블을 만들고 싶습니다. 나는 이렇게하고있다. 하지만 작동하지 않습니다. 도와주세요두 테이블을 하이브에 병합

select * into R5 from 
(select 
r.account_id as account_id, 
r.dim_account_key as dim_account_key, 
r.activation_date as activation_date, 
r.serial_number as serial_number 
from R5_1 r 
union all 
select 
s.account_id as account_id, 
s.dim_account_key as dim_account_key, 
s.activation_date as activation_date, 
s.serial_number as serial_number 
from R5_2 s) R 
+0

로 교체, 테이블에 데이터를 추가 할 것을 기억 : 같은 쿼리는 것 당신의 질문이 있습니까? –

답변

0

하이브에는 "SELECT INTO"문이 없습니다. 나는 당신이 "INSERT INTO TABLE"을 의미한다고 믿습니다.

INSERT INTO TABLE R5 
SELECT * FROM 
(select 
r.account_id as account_id, 
r.dim_account_key as dim_account_key, 
r.activation_date as activation_date, 
r.serial_number as serial_number 
from R5_1 r 
union all 
select 
s.account_id as account_id, 
s.dim_account_key as dim_account_key, 
s.activation_date as activation_date, 
s.serial_number as serial_number 
from R5_2 s) R 

이 표 INTO INSERT 당신이 덮어 쓰려면, 문제는 무엇 INSERT 덮어 쓰기 표

관련 문제