Correlated Subquery problem

mondo3

Registered User.
Local time
Today, 14:35
Joined
Jun 27, 2005
Messages
46
Where do I put the "AAA" in the following correlated subquery?
We print cards on multiple runs and place them on multiple skids. In the inner query, I'd like the overall sum of the card printed, while in the outer query, I'm showing the total of that card printed that's on each skid.

SELECT Docket.DocketID, Run.CardID, Sum(Run.PanelsPrintedCompleteA) AS SumOfPanelsPrintedCompleteA,
(
SELECT Sum(Run.PanelsPrintedCompleteA)
FROM Card INNER JOIN Run ON Card.CardID = Run.CardID
WHERE DocketID=[Forms]![frmDocket]![txtDocketNumberID].[value] AND Card.CardID=AAA.CardID
)

FROM (Docket INNER JOIN Skid ON Docket.DocketID = Skid.DocketID) INNER JOIN (Card INNER JOIN Run ON Card.CardID = Run.CardID) ON Skid.SkidID = Run.SkidID
WHERE (((Docket.DocketID)=123) AND ((Skid.Operator)='Jim'))
GROUP BY Docket.DocketID, Run.CardID
 

Users who are viewing this thread

Back
Top Bottom