group by - select top n posts by score count -


i trying top n users post using hive. table looks this.

score    user 10       1 20       2 50       1 20       2 0        3 3        1 40       2 ... 

i want generate output shows like

rows    users 3       1 3       2 1       3 

here query

select * (select count(score) score, userid count userid not null group userid,score limit 10) a; 

the output

0   0 0   1 0   2 0   3 0   4 0   5 0   6 0   7 0   8 0   9 

can guide me going wrong.

select count(score) score, userid userid not null group userid limit 10 

Comments