题解 | #月均完成试卷数不小于3的用户爱作答的类别#

月均完成试卷数不小于3的用户爱作答的类别

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

#有毒,是月均,意思是每个月都要>=3?????
#漏了group by  month(start_time) 一直报错

select distinct
    tag,
    count(tag) over (
        PARTITION BY
            tag
    ) tag_cnt
from
    (
        select
            *
        from
            exam_record
        where
             uid in (
                select
                    uid
                from
                    exam_record
                where submit_time is not null
                group by
                month(start_time),
                    uid
                having
                    count(uid) >= 3
            ) 
    ) s
    inner join examination_info e on e.exam_id = s.exam_id
order by tag_cnt desc


全部评论

相关推荐

无敌虾孝子:喜欢爸爸还是喜欢妈妈
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务