多谢一楼大佬指点,很清晰~之前思路局限在去重上面了,还是太菜 自己编了一下代码,不过不知道对不对 select page_name,avg(rank) as avg_rank from (
select user_id,page_name,dense_rank() over(partition by user_id order by ts) as rank
from(select user_id,page_name,min(ts) as ts from events
group by user_id,page_name) A
)B
group by page_name