sql - Not getting results for Top n records from group in hive -


i have 1 table table1 need show top 5 os based on highest counts need group them on 3 columns os,device,model

when executed below query didnt result. whats wrong in below query?

select *      (select distinct os, count,      dense_rank () on (partition os order count desc)rn      (select os ,device,model,sum(cal_count) count      table1      group os,device,model)b )      a.rn = 5      ; 

i write query this:

select t.* (select os, device, model, sum(cal_count) cnt,              dense_rank() on (partition os order sum(cal_count) desc) seqnum       table1       group os, device, model      ) t seqnum <= 5; 

as understand query, return 5th row each group. perhaps there sort of error.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -