题解 | 查询用户刷题日期和下一次刷题日期

select
    user_id,
    date,
    if (
        lead (date, 1) over (
            partition by
                user_id
            order by
                date
        ) is null,
        'None',
        lead (date, 1) over (
            partition by
                user_id
            order by
                date
        )
    ) nextdate
from
    test.questions_pass_record
order by
    user_id asc,
    date asc

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务