1。select B.pin,B.name,A.pin,sum(A.paysum) from A,B where A.pin=B.pin group by  B.pin;
group by后面的字段一般都要写在Select 语句后2。语句没有错,你看一看。

解决方案 »

  1.   

    如果你不写在select语句后,其实此处我认为group by a.pin是否更适合一些!
      

  2.   

    select B.name,A.pin,sum(A.paysum) from A,B where A.pin=B.pin group by  B.pin;B.Name和A.pin都不是分组的字段,不能直接列出。要么加Max或min,要么把他们加到group by中。
      

  3.   

    select max(B.name),A.pin,sum(A.paysum) from A,B where A.pin=B.pin group by  a.pin;b.name楼主是想达到什么样的效果?是否把所有name并列显示
      

  4.   

    sql语法规定,在group查询中,除了输出分组字段之外,其余字段只能使用分组聚合函数输出.