21,882
社区成员
发帖
与我相关
我的任务
分享
SELECT sc1.sid,
(SELECT score from sc sc2 where sc2.Sid=sc1.Sid and sc2.Cid='01') '01',
(SELECT score from sc sc2 where sc2.Sid=sc1.Sid and sc2.Cid='02') '02',
(SELECT score from sc sc2 where sc2.Sid=sc1.Sid and sc2.Cid='03') '03',
sc1.avgs
from
(SELECT sid,avg(score) avgs from sc GROUP BY sid) sc1
ORDER BY sc1.avgs desc