题解 | #最大连续回答问题天数>=3天的用户及其对应等级#
某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级
https://www.nowcoder.com/practice/e080f8a685bc4af3b47749ca3310f1fd
select author_id, author_level, max(day_cnt) from ( select author_id, min(author_level) as author_level, count(*) as day_cnt from ( select distinct author_id, answer_date, dense_rank() over ( partition by author_id order by answer_date ) as cnt from answer_tb ) as t1 inner join author_tb using(author_id) group by author_id, date_sub(answer_date, interval cnt day) having day_cnt >= 3 ) as t2 group by author_id, author_level