题解 | 某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级
某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级
https://www.nowcoder.com/practice/e080f8a685bc4af3b47749ca3310f1fd
select
t1.author_id, t1.author_level, max(t1.rn) as days_cnt
from(
select
an.author_id, au.author_level, an.answer_date,
dense_rank()over(partition by an.author_id order by an.answer_date) as rn
from
answer_tb an join author_tb au
on
an.author_id = au.author_id
)t1
where t1.rn >= 3
group by
author_id, author_level
查看6道真题和解析