如何在presto中编写sql? 这是我的SQL:
select
t.user_id,t.loguni_datetime,t.page_type,t.action_type,t.tab_name,
row_number() OVER (PARTITION BY t.user_id
ORDER BY log_time) AS rnk
from datamart_iptv_shyd_sh.f_visit_click_detail t
where t."year"='2019' and t."month"='07' and t."day"='10'
and t.page_type is not null
order by t.user_id,log_time
我明白了:
rnk距离以'/ epg / portal'
开头谢谢〜
答案 0 :(得分:0)
在分区上添加t.page_type并使用dense_rank
select
t.user_id,t.loguni_datetime,t.page_type,t.action_type,t.tab_name,
dense_rank() OVER (PARTITION BY t.user_id,t.page_type
ORDER BY log_time) AS rnk
from datamart_iptv_shyd_sh.f_visit_click_detail t
where t."year"='2019' and t."month"='07' and t."day"='10'
and t.page_type is not null
order by t.user_id,log_time