题目写得不是很清楚
 select a.name,b.id,sum()    from student a,notes
     b group by b.id,a.name

解决方案 »

  1.   

    你在表中必须为月份建立一个字段month,与成绩联系起来,不然怎么知道该成绩是属于那一个月的,那如何统计哪三个月的成绩?
    select name,sum() from student a, b where a.id=b.id and month>=1 and month<=3
      

  2.   

    select student.name as 学生,sum() as 三个朋分数和
    from student,notes
    where student.id=notes.id
    group by student.name;
      

  3.   

    同意caoruomou(caoruomou)的意见
    是哪个月的月考分数?应该在表中建立相应字段加以区别
    这样统计三个月的时候就可以相应提取group by如果不声明就像jackshs(jack_shi)说的那样,直接group by name即可
      

  4.   

    另一个:
    select 
        t1.id as 学生,
        t1.sumMark as 三个月分数和
    from 
        (select id ,sum() sumMark from notes group by id) t1,
        student t2
    where
        t1.id = t2.id
      

  5.   

    那就像楼上说的,表join一下,对id做group by 就好了select max(s.name),s.id,sum(n.) from students s , notes n
    where s.id = n.id 
    group by s.id