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

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

全部评论

相关推荐

大专人陈义:95ye都找不到实习了,看样子是真的没岗位了
投递京东等公司9个岗位
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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