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

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

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

with data_f_use as (
    select uid, exam_id, start_time, submit_time, tag
    from exam_record
    left join examination_info using (exam_id)
)
 select tag, count(tag) as tag_cnt
 from data_f_use
 where uid in (
        select uid
        from exam_record
        where submit_time is not null
        group by uid
        having (count(exam_id) / count(distinct date_format(start_time, '%Y%m'))) >= 3
    )
  group by tag
  order by tag_cnt desc
月均完成试卷数不小于3的用户必须从submit_time is not null 里筛选
用户爱作答类别必须从所有数据里筛选
全部评论

相关推荐

强大的马里奥:不太可能,我校计算机硕士就业率99%
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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