G
Guest
I've been following the discussions on Running Sums in a Query. I've successfully created a SQL statement that gives me the running sum over the entire query, however I can't get the Running Sum to start over for different groups. Here's my SQL text
SELECT [qsel Sales Detail].Key, [qsel Sales Detail].Salon_ID, [qsel Sales Detail].Fiscal_Year, [qsel Sales Detail].Fiscal_Period, [qsel Sales Detail].SumOfNet_Sales, Sum(Temp.SumOfNet_Sales) AS RunningSu
FROM [qsel Sales Detail], [qsel Sales Detail] AS Tem
WHERE ((([qsel Sales Detail].Key)>=[temp].[key])
GROUP BY [qsel Sales Detail].Key, [qsel Sales Detail].Salon_ID, [qsel Sales Detail].Fiscal_Year, [qsel Sales Detail].Fiscal_Period, [qsel Sales Detail].SumOfNet_Sale
ORDER BY [qsel Sales Detail].Salon_ID, [qsel Sales Detail].Fiscal_Year
The key is a unique field made up by concatenating Salon_ID, Fiscal_Year, and Fiscal_Period
I need my Running Sum to start over with each change in Fiscal_Year AND Salon_ID. Any help would be appreciated!
SELECT [qsel Sales Detail].Key, [qsel Sales Detail].Salon_ID, [qsel Sales Detail].Fiscal_Year, [qsel Sales Detail].Fiscal_Period, [qsel Sales Detail].SumOfNet_Sales, Sum(Temp.SumOfNet_Sales) AS RunningSu
FROM [qsel Sales Detail], [qsel Sales Detail] AS Tem
WHERE ((([qsel Sales Detail].Key)>=[temp].[key])
GROUP BY [qsel Sales Detail].Key, [qsel Sales Detail].Salon_ID, [qsel Sales Detail].Fiscal_Year, [qsel Sales Detail].Fiscal_Period, [qsel Sales Detail].SumOfNet_Sale
ORDER BY [qsel Sales Detail].Salon_ID, [qsel Sales Detail].Fiscal_Year
The key is a unique field made up by concatenating Salon_ID, Fiscal_Year, and Fiscal_Period
I need my Running Sum to start over with each change in Fiscal_Year AND Salon_ID. Any help would be appreciated!