Hive中将多个查询结果按行拼接成一张表

来源:互联网 发布:windows怎样启动过程 编辑:程序博客网 时间:2024/05/23 17:41

在hive中将多个查询结果拼接成一张表,存入到另一张表中

一、语句

insert into table xiaoyuan_24_traffic_result partition (day_id = '20160506') 

select a.phone_id, a.traffic, b.traffic

    from (select *

            from xiaoyuan_hour_traffic

           where day_id = '20160506'

             and test_time = '00') a

    left join (select *

                 from xiaoyuan_hour_traffic

                where day_id = '20160506'

                  and test_time = '01') b

      on (a.phone_id = b.phone_id)

    left join (select *

                 from xiaoyuan_hour_traffic

                where day_id = '20160506'

                  and test_time = '02') c

      on (a.phone_id = c.phone_id);

二、语句说明

0 0