题解 | #某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级#

某乎问答最大连续回答问题天数大于等于3天的用户及其对应等级

http://www.nowcoder.com/practice/e080f8a685bc4af3b47749ca3310f1fd

select t2.author_id, t3.author_level, t2.days_cnt from (select author_id,count(1) as days_cnt from (select distinct answer_date, author_id, dense_rank() over(partition by author_id order by answer_date) as rk from answer_tb) t1 group by t1.author_id,date_sub(t1.answer_date,interval rk day) having count(1)>=3) t2 left join author_tb t3 on t2.author_id=t3.author_id order by t2.author_id

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务