Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Inserting data from multiple hive table to one one hive table.

avatar
Explorer

Hi

I am in the process to create one dernormalized table and feed this table from multiple hive tables so

my question is do I need to write multiple insert because there are total 13 tables but there is no single common column(field) in all of them.

 

Thanks

Sukrut

2 REPLIES 2

avatar
Super Collaborator

Hi,

 

Can you try the query something like below to insert the data from multiple tables?

 

insert into DemoTable1945(StudentName,StudentAge) select tbl1.Name,tbl2.Age from DemoTable1943 tbl1,DemoTable1944 tbl2;

 

Let us know if this helps.

 

Regards,

Chethan YM

avatar
Explorer

Thanks for your update.

I have 10 hive tables and I am inserting data from these 10 tables to one hive denorm table but we have some conditions for few columns.
Here every column is coming from some table and I need to put populate the column only if certain condition is true for example if table has name,age,salary column and condition is like if salary is 1000 then populate name column.

INSERT INTO TABLE MANAGE(NAME,country)SELECT TABLENAME.NAME,TABLENAME.COUNTRY FROM TABLE1,TABLE2

How can I populate the name column with some condition.