有两个acces表. a表 (班别,总分) B表(班别,科任) .现想实现  班别,总分平均分 ,科任.用以下语句:
select a.班别, b.班主任, avg( a.总分) as 平均分   from a,b where a.班别=b.班别 group by a.班别又用: select a.班别,  avg( a.总分) as 平均分   from a join b on a.班别=b.班别 group by a.班别都不行,有办法吗?
 

解决方案 »

  1.   

    select a.班别, b.班主任, 平均分 = (select avg( 总分) from a T2 where T2.班别 = T1.班别) 
    from a T1,b where T1.班别=b.班别
      

  2.   

    select T1.班别, b.班主任, 平均分 = (select avg( T2.总分) from a T2 where T2.班别 = T1.班别)  
    from a T1,b where T1.班别=b.班别
      

  3.   

    dll0629 兄,好像不行.我试了.提示参数不足,期待2.还有办法没有?
      

  4.   

    大哥 你还是好好学习SQL语言吧
      

  5.   

    select a.班别,Max(b.班主任)as 班主任  avg( a.总分) as 平均分   
    from a , b 
    Where a.班别=b.班别 
    group by a.班别