解决方案 »

  1.   


    mysql> select a.* From score A join (
        -> SELECT cno,sum(degree)/count(*) as Avg
        -> FROM score Group by cno )B on A.cno=B.cno
        -> order by b.avg,a.degree;
    +-----+-------+--------+
    | SNO | CNO   | DEGREE |
    +-----+-------+--------+
    | 109 | 3-245 |   68.0 |
    | 105 | 3-245 |   75.0 |
    | 103 | 3-245 |   86.0 |
    | 107 | 6-106 |   79.0 |
    | 101 | 3-105 |   64.0 |
    | 109 | 3-105 |   76.0 |
    | 108 | 3-105 |   78.0 |
    | 105 | 3-105 |   88.0 |
    | 107 | 3-105 |   91.0 |
    | 103 | 3-105 |   92.0 |
    | 108 | 6-166 |   81.0 |
    | 101 | 6-166 |   85.0 |
    +-----+-------+--------+
    12 rows in set (0.00 sec)mysql>