hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj hive <raj.hiv...@gmail.com>
Subject hive query
Date Fri, 12 Aug 2016 12:28:20 GMT
Dear Friends,


I have a hive table with column name Keyword,Hour,TotalTweets.

for example, I have the date for three keyword as below.

*Keyword    Hour    TotalCount*

 iphone       11           500
 iphone       12           1000
 Samsung   11           300
 Samsung   12           600
 Nokia         12           200
 Iphone       16          1500

 I want a query to get output for 24 hours like below. I need to show the
zero count if i don't have the data. Can anyone help me the hive query.


*Keyword* *hour* *TotalCount*
iphone 0 0
samsung 0 0
nokia 0 0
iphone 1 0
samsung 1 0
nokia 1 0
iphone 2 0
samsung 2 0
nokia 2 0
iphone 3 0
samsung 3 0
nokia 3 0
iphone 4 0
samsung 4 0
nokia 4 0
iphone 5 0
samsung 5 0
nokia 5 0
iphone 6 0
samsung 6 0
nokia 6 0
iphone 7 0
samsung 7 0
nokia 7 0
iphone 8 0
samsung 8 0
nokia 8 0
iphone 9 0
samsung 9 0
nokia 9 0
iphone 10 0
samsung 10 0
nokia 10 0
iphone 11 500
samsung 11 300
nokia 11 0
iphone 12 1000
samsung 12 600
nokia 12 200
iphone 13 0
samsung 13 0
nokia 13 0
iphone 14 0
samsung 14 0
nokia 14 0
iphone 15 0
samsung 15 0
nokia 15 0
iphone 16 0
samsung 16 0
nokia 16 1500
iphone 17 0
samsung 17 0
nokia 17 0
iphone 18 0
samsung 18 0
nokia 18 0
iphone 19 0
samsung 19 0
nokia 19 0
iphone 20 0
samsung 20 0
nokia 20 0
iphone 21 0
samsung 21 0
nokia 21 0
iphone 22 0
samsung 22 0
nokia 22 0
iphone 23 0
samsung 23 0
nokia 23 0

Mime
View raw message