I'm new to Access. I figured out how to create a query that sums data from rows in a table using INNER JOIN / GROUP, using one set of criteria for adding.
- The first 3 columns in attachment (in grey) are from the table ("Sheet1"), the 4th column was generated using the SQL code I show at the bottom. This 4th column, YTD Sales_by_Acct, adds up Sales for all Accts with the same Acct number.
- How would I generate the 5th column in the attached, where Sales are added (a) for all Accts with the same Acct number (per the 4th column), (b) for all Months <= the month specified in the 2nd column?

Here's the SQL code I used to generate the 4th column, Sales_by_Acct:
SELECT XX.*, Sales_by_Acct
FROM Sheet1 AS XX
INNER JOIN
(SELECT [Acct], SUM([Sales]) AS Sales_by_Acct
FROM Sheet1
GROUP BY [Acct])
AS groupSales_by_Acct ON XX.[Acct] = groupSales_by_Acct.[Acct];