sql sum

来源:互联网 发布:淘宝恶意买家不想发货 编辑:程序博客网 时间:2024/06/14 05:44
hive -e "create table default.tbl_play_info_29 asselect p1,p2,deviceid,sum(case when pt <= 180 and pt >= 0 then 1 else 0 end) cor_num,sum(case when pt>180 or pt<0 then 1 else 0 end) err_num from data_raw.tbl_play_hour where dt='20150329' and act='time' group by p1,p2,deviceid;"hive -e "create table default.tbl_pt_29_lzy as select a.p1,a.p2,a.app,sum(b.cor_num) cor_num,sum(b.err_num) err_num from default.tbl_app_info_29 a left outer join default.tbl_play_info_29 b on a.p1=b.p1 and a.p2=b.p2 and a.mac=b.deviceid group by a.p1,a.p2,a.app;"
0 0
原创粉丝点击