I am trying to create a 12 month rolling sum query for emissions that is grouped by two different fields (WellID and Date) but the results are summing the emissions from all the WellIDs (the rolling part is working) and only grouping by Date. For example, emissions from all WellIDs in January 2011 is 82 tons, but I want emissions from ONLY one WellID for January 2011. It is applying this 82 tons value to all WellIDs in January 2011. How can I get it to sum by both individual WellID and Date? Here's the SQL:

qryRollingSumCntrlled
PARAMETERS BegDate DateTime, EndDate DateTime;
SELECT WellPadName, PrdctnDate, SUM(RollingControlled) AS SumRollingControlled
FROM (SELECT qrySumContrlledandUncontrlled.WellPadName, qrySumContrlledandUncontrlled.PrdctnDate, qrySumContrlledandUncontrlled.TotalControlled, (SELECT Sum(TotalControlled) AS RollingControlled FROM qrySumContrlledandUncontrlled AS Alias WHERE Alias.PrdctnDate<=qrySumContrlledandUncontrlled.Pr dctnDate And Alias.PrdctnDate>dateadd('m',-12,qrySumContrlledandUncontrlled.PrdctnDate)) AS RollingControlled FROM qrySumContrlledandUncontrlled) AS ALIAS
GROUP BY WellPadName, PrdctnDate;

SQL query that the previous query is referencing (qrySumContrlledandUncontrlled):

PARAMETERS BegDate DateTime, EndDate DateTime;
SELECT ALIAS.tblWellPadName.WellPadName, ALIAS.tblAppendUncntrlledCntrlled.PrdctnDate, Sum(ALIAS.SumUncontrolled) AS TotalUncontrolled, Sum(ALIAS.SumControlled) AS TotalControlled
FROM (SELECT tblWellPadName.WellPadName, tblAppendUncntrlledCntrlled.WellID, tblAppendUncntrlledCntrlled.PrdctnDate, [WellGenUncontrolled]+[OilTankUncontrolled]+[PumpJackUncontrolled]+[RecycleMotorUncontrolled]+[TruckLoadingUncontrolled]+[TreaterBurnerUncontrolled]+[TreaterGasUncontrolled]+[WaterProdUncontrolled] AS SumUncontrolled, [WellGenControlled]+[OilTankControlled]+[PumpJackControlled]+[RecycleMotorControlled]+[TruckLoadingControlled]+[TreaterBurnerControlled]+[TreaterGasControlled]+[WaterProdControlled] AS SumControlled FROM tblWellPadName INNER JOIN ((tblAppendUncntrlledCntrlled INNER JOIN tblWellID ON tblAppendUncntrlledCntrlled.WellID = tblWellID.WellID) INNER JOIN tblWellPadID ON tblWellID.WellID = tblWellPadID.WellID) ON tblWellPadName.WellPadID = tblWellPadID.WellPadID) AS ALIAS
WHERE (((ALIAS.PrdctnDate) Between DateAdd('m',-12,[BegDate]) And [EndDate]))
GROUP BY ALIAS.WellPadName, ALIAS.PrdctnDate;

Thanks for the help!