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

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

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

select
    ei.tag as tag,
    count(*) as tag_cnt
from
    exam_record er
    left join examination_info ei on er.exam_id = ei.exam_id
    inner join 
     (
        SELECT
            distinct uid
        FROM
            exam_record
        where
            submit_time is not null
        GROUP BY
            uid,
            month(submit_time)
        HAVING
            count(submit_time) > 2
    ) u on er.uid = u.uid
group by
    tag
order by
    tag_cnt desc

全部评论

相关推荐

有趣的牛油果开挂了:最近这个阶段收到些杂七杂八的短信是真的烦
点赞 评论 收藏
分享
2 收藏 评论
分享
牛客网
牛客企业服务