【问题标题】:How to load the values of three column from one table1 to another table 2 which is having single column in hive?如何将三列的值从一个表 1 加载到另一个表 2 中,该表在配置单元中有单列?
【发布时间】:2021-06-04 01:23:08
【问题描述】:
你能帮我下面的查询吗?
表 1(输入)有三列(Credit_date、Debit_date、Payment_date)和
表 2(输出)有一列日期
表 1 中的三列值应该在 表 2 中可用。
我尝试了以下查询但没有工作。
insert into table2
select date
from (
(select credit_date, debit_date, Payment_date from table 1) as date)t;
请指导一下。
【问题讨论】:
标签:
hadoop
hive
subquery
bigdata
derived-column
【解决方案1】:
尝试联合所有:
insert into table2
select * from (
select credit_date as date from table1
union all
select debit_date as date from table1
union all
select payment_date as date from table1
) t