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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ght_online/article/details/51364863

在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);

二、语句说明

展开阅读全文

没有更多推荐了,返回首页