hive - Sum col2 of two tables based on duplicate matching col1 -
i have 2 tables both structured (id, views)
table 1: id views 1 b 2 b 3 c 3 c 4 d 4 table 2: id views c 1 d 3 d 4 e 5 e 7 f 8 i'm looking sum views of ids both in table 1 , 2 (id c , d) in case output be:
table 3: id views c 8 d 11
you use following query in case :
select a.id,sum(a.views) ( select * table1 union table2 ) group id;
Comments
Post a Comment