题解 | 就这样吧,可以简化很多,犯懒了,不简化了,作差方式
某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级
https://www.nowcoder.com/practice/e080f8a685bc4af3b47749ca3310f1fd
select t1.author_id, ab.author_level, t1.pt from( select t.author_id, count(*) as pt from( select author_id, answer_date, row_number()over(partition by author_id order by answer_date) as m from answer_tb group by author_id,answer_date having count(distinct issue_id)>=1 ) as t group by subdate(t.answer_date,t.m),t.author_id having count(*)>=3 ) as t1 left join author_tb ab on t1.author_id=ab.author_id order by t1.author_id asc