考试分数(二)

简介

第二个select一定要起一个别名,否则会出错
注意子查询

select a.id, a.job, a.score from
grade as a
left join
(
    select job, avg(c.score) as score from
    grade as c
    group by c.job
) as b
on a.job = b.job
where a.score > b.score;
Hope is a good thing,maybe the best of things,and no good thing ever dies.----------- Andy Dufresne
原文地址:https://www.cnblogs.com/eat-too-much/p/14959143.html