日期:2014-05-18  浏览次数:20751 次

SQL问题,关于求和
表A:
UID_A, SONo, Qty 
表B:
UID_A ,UID_B,Line
表C:
SONo,Line,QtyB

我想Select Qty,Line,Sum(Qty )
要求是A.UID_A=B.UID_A C.SONo=A.SONo B.Line=C.Line

------解决方案--------------------
SQL code
select B.Line,Sum(Qty ) from A,B,C
where A.UID_A=B.UID_A and  C.SONo=A.SONo and B.Line=C.Line
group by B.Line

------解决方案--------------------
SQL code

Select B.Line,A.Qty,Sum(A.Qty) from A,B,C 
where A.UID_A=B.UID_A and C.SONo=A.SONo and B.Line=C.Line 
group by B.Line

------解决方案--------------------
探讨
SQL code
Select B.Line,A.Qty,Sum(A.Qty) from A,B,C
where A.UID_A=B.UID_A and C.SONo=A.SONo and B.Line=C.Line
group by B.Line

------解决方案--------------------
探讨
SQL code
Select B.Line,A.Qty,Sum(A.Qty) from A,B,C
where A.UID_A=B.UID_A and C.SONo=A.SONo and B.Line=C.Line
group by B.Line