Running Sums with queries 
Author Message
 Running Sums with queries

Does anyone know how to create a running sum field into a Query (not into a
report) ?
--
Luca Cesarini



Sat, 08 Dec 2001 03:00:00 GMT  
 Running Sums with queries
This works on the Orders table in Northwind.

BTW, I would never actually use something like this in a query.
It is WAY too slow.

SELECT DISTINCTROW DatePart("yyyy",[Order Date]) AS AYear,
DatePart("m",[Order Date]) AS AMonth,
DSum("Freight","Orders","DatePart('m',[Order Date])<=" & [AMonth] & " And
DatePart('yyyy',[Order Date])<=" & [AYear] & " ") AS RunTotal, Format([Order
Date],"mmm") AS FDate
FROM Orders
WHERE (((DatePart("yyyy",[Order Date]))=1991))
GROUP BY DatePart("yyyy",[Order Date]), DatePart("m",[Order Date]),
Format([Order Date],"mmm")
ORDER BY DatePart("yyyy",[Order Date]), DatePart("m",[Order Date]),
Format([Order Date],"mmm");

--
HTH
Joe
Check out Dev Ashish's web site for answers to common questions
http://home.att.net/~dashish/


Quote:
> Does anyone know how to create a running sum field into a Query (not into
a
> report) ?
> --
> Luca Cesarini




Sat, 08 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Creating a running sum query

2. How to do Running Sum in a Query

3. Need help with joined table sum query

4. SQL:How do i query sums???????

5. funny Sum statement in msaccess query

6. how to sum fields that are not included in the sql query

7. Getting the value of a Sum() in a SQL query

8. Accessing SUM results from a SELECT query

9. How to do a Running Sum with Only Negatives

10. Running sums on a FORM??

11. Running sum

12. Running sum question again

 

 
Powered by phpBB® Forum Software