首页 > 其他 > 详细

hive中多表关联

时间:2015-09-01 12:43:33      阅读:459      评论:0      收藏:0      [点我收藏+]
use noc_dpi;

CREATE table IF NOT EXISTS tmp_yym_app(appname STRING, mdn_num int, inputoctets int,outputoctet int)

row format delimited fields terminated by ‘|‘ stored as textfile 

location ‘/user/noc/private/tmp_yym_app‘; 

insert overwrite table tmp_yym_app

select tt.appname,count(distinct mdn),sum(tt.inputoctets),sum(tt.outputoctets) from 

(select t.*  from NOC_3G_APP_USER_SUMMARY  t join liming_test_mdn m on 

 t.mdn=m.mdn and m.mdn<>‘‘ and m.mdn is not null where t.dt=$appdate1

union all 

  select t.*  from NOC_4G_APP_USER_SUMMARY  t join liming_test_mdn m on 

 t.mdn=m.mdn and m.mdn<>‘‘ and m.mdn is not null where t.dt=$appdate1) tt

 group by tt.appname

hive中多表关联

原文:http://my.oschina.net/u/1866459/blog/499958

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!