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

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

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

# 以author_id分组,将回答天数>=3天的删选出来,之后再看是否连续(将日期放到一个字符串中?)
select a.author_id, author_level, answer_days
from (
    select count(distinct answer_date) as answer_days, author_id
    from answer_tb
    group by author_id
    having answer_days >= 3
) as a
left join author_tb as b
on a.author_id = b.author_id
order by author_id;

全部评论
测试用例不全面,根本都不需要看是否天数连续了,我的代码直接过了
点赞 回复 分享
发布于 2023-08-03 14:50 江苏

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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