I have the following query:
Which returns these results:
What I want is:
Can anyone help me?
Thanks,
JW
Code:
SELECT A.ITEMCODE, A.DESCRIPTION, A.OHQTY, B.TotSum AS BAL
FROM qryBalls AS A INNER JOIN [SELECT ITEMCODE, Sum(OHQTY) AS TotSum FROM qryBalls GROUP BY ITEMCODE]. AS B ON A.ITEMCODE = B.ITEMCODE;
Which returns these results:
Code:
ITEMCODE DESCRIPTION QHQTY BAL
112840008 5B 9/32 40 195
112840008 5B 9/32 70 195
112840008 5B 9/32 85 195
112840021 5B 9/16 27 27
120840242 2B 1/4 10 54 509
120840242 2B 1/4 10 65 509
120840242 2B 1/4 10 87 509
120840242 2B 1/4 10 303 509
What I want is:
Code:
ITEMCODE DESCRIPTION QHQTY BAL
112840008 5B 9/32 40 40
112840008 5B 9/32 70 110
112840008 5B 9/32 85 195
112840021 5B 9/16 27 27
120840242 2B 1/4 10 54 54
120840242 2B 1/4 10 65 119
120840242 2B 1/4 10 87 206
120840242 2B 1/4 10 303 509
Can anyone help me?
Thanks,
JW