select A.colu1,sum(C.colu2)
from table1 A,table2 B,table3 C
where A.colu2=B.colu1 and B.colu2=C.colu1
group by A.colu1;
语句语法没问题,只是结果可能不是你想要的,sum(C.colu2)不是2.5+4.6,而应该是2*(2.5+4.6)改为
select A.colu1,sum(C.colu2)
from table1 A,(select distinct colu1,colu2 from table2) B,table3 C
where A.colu2=B.colu1 and B.colu2=C.colu1
group by A.colu1;

解决方案 »

  1.   

    select a.colu1,sum(a.colu2) from 
    (select A.colu1,C.colu2
    from table1 A,table2 B,table3 C
    where A.colu2=B.colu1 and B.colu2=C.colu1) a
    group by a.colu1
      

  2.   

    没有什么错.
    不知道你具体想作什么,sql语句还是要自己测试的.
      

  3.   

    good , Lastdrop(空杯) 的说法是应该是对的,正是我要的结果,我去测试一下,非常感谢!
      

  4.   

    我测试执行了,SQL正确无误,执行结果是:
    CO SUM(C.COLU2)
    -- ------------
    a1            5