【发布时间】:2019-07-16 12:19:53
【问题描述】:
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
我明白了:
但我想通过 userid 和 page_type 得到分区,如下所示:
rnk 客场以 '/epg/portal' 开头
谢谢~
【问题讨论】:
-
您的查询引用了
year、month和day,但这些不在您的结果集中。你说按page_type分区,但action_type似乎更合适。这个问题很不清楚。 -
不好意思,我的英文很差,想用userid分区,然后pagetype进行时间排序,遇到portl页面重新排序。结果像第二张图中的红字。