题解 | #获得积分最多的人(二)#

获得积分最多的人(二)

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

-- 完全的笨方法、、
select
    t1.id,
    t1.name,
    t2.grade_num
from
    user as t1
    join (
        select
            user_id,
            sum(grade_num) as grade_num
        from
            grade_info
        group by
            user_id
    ) as t2 on t1.id = t2.user_id
where t2.grade_num = (
select
    max(grade_num)
from
    (
        select
            user_id,
            sum(grade_num) as grade_num
        from
            grade_info
        group by
            user_id
    ) as t1);

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务