Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Running total query not accepted in Access?

Author  Topic 

iancuct
Yak Posting Veteran

73 Posts

Posted - 2002-09-30 : 10:11:49
Hi I have a table that i want to do a running totals on one of the colums , the table is actually a querry , so i am doing a select withing a select but access does not let me save the query something about syntax

here is my querry



SELECT A.WeekEndingDate,
A.SumOfBudgetedSpent,
SUM(B.SumOfBudgetedSpent)
FROM
(
( SELECT EVMS_SubTaskSpending.WeekEndingDate,
Sum(EVMS_SubTaskSpending.BudgetedSpent) AS SumOfBudgetedSpent
FROM EVMS_SubTaskSpending
WHERE (((EVMS_SubTaskSpending.ChargeNumber)=[Forms]![EVMS-Select Task]![cmb_ChargeNumber]) AND ((EVMS_SubTaskSpending.JobNumber)=[Forms]![EVMS-Select Task]![cmb_Job]))
GROUP BY EVMS_SubTaskSpending.WeekEndingDate
) AS A

CROSS JOIN
(
SELECT EVMS_SubTaskSpending.WeekEndingDate,
Sum(EVMS_SubTaskSpending.BudgetedSpent) AS SumOfBudgetedSpent
FROM EVMS_SubTaskSpending
WHERE (((EVMS_SubTaskSpending.ChargeNumber)=[Forms]![EVMS-Select Task]![cmb_ChargeNumber]) AND ((EVMS_SubTaskSpending.JobNumber)=[Forms]![EVMS-Select Task]![cmb_Job]))
GROUP BY EVMS_SubTaskSpending.WeekEndingDate
) AS B
)
Where (B.WeekEndingDate<=A.WeekEndingDate) As RunningTotal
GROUP BY A.WeekEndingDate, A.SumOfBudgetedSpent
ORDER BY A.WeekEndingDate, A.SumOfBudgetedSpent


This is the table that the subquery returns
so


WeekEndingDate SumOfBudgetedSpent
4/14/2002 $453.37
4/21/2002 $453.37
4/28/2002 $453.37
5/5/2002 $453.37
5/12/2002 $453.37
5/19/2002 $453.37
i am tring to crossjoing the subqueries and get
a variation of the above table with an additional
column with the Cummulative SumOfBudgetedSpent
so it would look something like this

WeekEndingDate SumOfBudgetedSpent
4/14/2002 $453.37
4/21/2002 $906.74
4/28/2002 $1360.11


why isn't access acepting my query please help

   

- Advertisement -