1
子組內使用排名
嘿,我試圖讓這個查詢使用rank()
工作,但我有沒有運氣,在HIVE
select t.orig, t.id, count(*) as num_actions,
rank() over (partition by t.orig order by count(*) desc) as rank
from sample_table t
where rank < 21
and t.month in (201607,20608,201609,201610,201611,201612)
and t.orig in (select tw.pageid from tw_sample as tw limit 50)
group by t.orig, t.id
我不斷收到,
失敗:SemanticException [錯誤10004]:第4行:6無效的表別名或列參考'級'
我的目標是抓住每個t.orig
前20行的基礎上count(*)
參數。
如果你也能解釋我哪裏錯了,所以我可以從中學到,那將不勝感激。
完美,謝謝! –