通过代码

SELECT
    level,
    count('level') level_cnt
FROM
    user_info u
WHERE
    u.uid in (
        SELECT
            uid
        FROM
            exam_record e_r
        LEFT JOIN
            examination_info e_i
        on
            e_r.exam_id = e_i.exam_id
        WHERE
            tag = 'SQL'and
            score > 80) 
GROUP BY
    level
ORDER BY
    level_cnt desc;

emm没啥说的很简单,表连接查符合条件的uid,然后筛选对应的level,count就行。

哦对,where in 果然比再套一层select看着舒服

旧知识时间

left join 左边是主表右边是从表

right join 右边是主表,左边是从表