题解 | #最大连续回答问题天数大于等于3天#
某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级
https://www.nowcoder.com/practice/e080f8a685bc4af3b47749ca3310f1fd
select t1.author_id, author_level, days_cnt from( select author_id, 1+count(1) as days_cnt from( select author_id, answer_date as dt, lead(answer_date,1) over (partition by author_id order by answer_date asc) as ld from answer_tb) as a where datediff(dt,ld) = -1 group by 1 having count(1) >= 2) as t1 left join author_tb as t2 on t1.author_id = t2.author_id