Hive insert into partitioned table with colums list from select

1.9k views Asked by At

I want to insert into a partitioned Hive table tb_1(a, b, c, d, p1) only columns (a, b) from a select statement. Ex: insert into table tb_1 partition (p1) (a, b) select a, b from tb_2;

How can I achieve this?

1

There are 1 answers

0
Koushik Roy On BEST ANSWER

correct SQL should be -

insert into table tb_1 partition (p1) (a, b, p1) select a, b,p1 from tb_2;

You need to add p1 in the insert list and select list.