sql求加权平均值

select sum(total) / sum(credit)
from (select score * credit total, credit from choose, course where choose.cid = course.cid and sid = '001') as temp;

Student

Choose

course

sid

name

 

sid

cid

score

cid

name

credit


你可能感兴趣的:(sql求加权平均值)