select classid,max(bz),sum(b.maths),sum(b.chinese) from A,B where A.classid=B.classid group by classid

解决方案 »

  1.   

    在这一子查询或聚合表达式中,text、ntext 和 image 数据类型无效。怎么办啊!!大家帮帮忙啊!!!
      

  2.   

    group by 只能对nvarchar int 等字段做聚合,如果是ntext就不行了! 
    如果在sql里可以对nText做Group by 操作 
      

  3.   

    select c.bz,d.a,d.b,d.c 
    from 
    (select classid as a,sum(b.maths) as b,sum(b.chinese) as c  from A,B where A.classid=B.classid group by classid) d,A c 
    where c.classid=d.a