题解 | #满足条件的用户的试卷完成数和题目练习数#

满足条件的用户的试卷完成数和题目练习数

https://www.nowcoder.com/practice/5c03f761b36046649ee71f05e1ceecbf

代码通过了自测运行,但提交的时候通不过。蹲一个指导

    u.uid,
    count(distinct er.submit_time) as exam_cnt,
    count(distinct p.submit_time) as question_cnt
from
    user_info as u
    inner join exam_record as er on u.uid = er.uid
    inner join examination_info as ei on ei.exam_id = er.exam_id
    left join  practice_record as p on u.uid = p.uid
where
     u.uid in (
        select
            u.uid
        from
            user_info as u
            inner join exam_record as er on u.uid = er.uid
            inner join examination_info as ei on ei.exam_id = er.exam_id
        where
            ei.tag = "SQL"
            and ei.difficulty = "hard"
            and u.level = 7
            and year(er.submit_time) = 2021
            group by u.uid
            having(er.score)>80        
    )
group by
    u.uid
order by
    exam_cnt,
    question_cnt DESC
全部评论

相关推荐

想踩缝纫机的小师弟练...:不理解你们这些人,要放记录就把对方公司名字放出来啊。不然怎么网暴他们
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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