#题解 最大连续回答问题天数大于等于3天的用户及其对应等级#
某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级
https://www.nowcoder.com/practice/e080f8a685bc4af3b47749ca3310f1fd
#计算连续:当天-首日=排名-1 with t1 as ( select distinct author_id,answer_date, min(answer_date) over(partition by author_id) mnd, dense_rank() over(partition by author_id order by answer_date) as dr from answer_tb ) select author_id,author_level,max(dr) from t1 inner join author_tb using(author_id) where answer_date-mnd=dr-1 and dr>=3 group by author_id,author_level