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

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

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

  • 原来group by 之前可以用where语句? ! 我一直以为用了group by 就只能用having。现在纠正过来这个知识点
  • 正确理解:当月均完成试卷数”不小于3的用户

count(exam_id) / count(distinct DATE_FORMAT (start_time, "%Y%M")) >= 3

原来上一次刷题竟是上个月月底,隔了10来天没刷又手生了。现在赶上!这个月中旬,争取把这套进阶题库刷完!!加油!

select
    tag,
    count(tag) as tag_cnt
from
    exam_record
    left join examination_info using (exam_id)
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

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-11 15:08
点赞 评论 收藏
分享
那一天的Java_J...:他本来公司就是做这个的,不就是正常的游戏客户端和服务器开发,软硬件联动,有啥恶心不恶心的,提前告诉你就是怕你接受不了,接受不了就没必要再往后走流程浪费时间,虽然这公司是一坨。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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