题解 | 考试分数(三)

SELECT
    id,
    `name`,
    score
FROM
    (
        SELECT
            g.id,
            `name`,
            score,
            DENSE_RANK() over (
                PARTITION BY
                    `name`
                ORDER BY
                    score DESC
            ) AS ranking
        FROM
            grade AS g,
            `language` AS l
        WHERE
            g.language_id = l.id
    ) AS t
WHERE
    t.ranking = 1
    OR t.ranking = 2
ORDER BY
    `name` ASC,
    score DESC,
    t.id ASC

全部评论

相关推荐

01-21 12:25
产品经理
蝴蝶飞出了潜水钟丿:是不是在暗示男女待遇不一样xxn要来冲你了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务