题解 | 就这样吧,可以简化很多,犯懒了,不简化了,作差方式

某乎问答最大连续回答问题天数大于等于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

全部评论

相关推荐

09-23 15:16
门头沟学院 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
收拾收拾准备躺平咯
在秋招的河老师很爱吃:兄弟你吃拼好饭中毒了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务