select sum(grade) sum_grade from stu s where s.id in( select t1.id from stu t1 inner join stu t2 on t1.id=t2.c_id ); select * from stu;