[AccessD] Running sum in a query without DSUM

John Skolits askolits at ot.com
Thu Oct 26 09:24:06 CDT 2006


Thanks Jim.
That makes sense but it still essentially does a dsum in the embedded select
statement. It then runs very slowly for large tables.

Thanks

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hale, Jim
Sent: Wednesday, October 25, 2006 5:35 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Running sum in a query without DSUM

Here is some a method from a query samples database I got from Lord knows
where. HTH
Jim Hale


SELECT [Order Details].OrderID, Sum([UnitPrice]*[Quantity]*(1-[Discount]))
AS OrderTotal, (SELECT Sum(UnitPrice*Quantity*(1-Discount)) FROM [Order
Details] OD WHERE OD.OrderID <= [Order Details].OrderID) AS RunningTotal
FROM [Order Details]
GROUP BY [Order Details].OrderID;

-----Original Message-----
From: John Skolits [mailto:askolits at ot.com]
Sent: Wednesday, October 25, 2006 3:23 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Running sum in a query without DSUM



Any way to do a running sum in a "query" without having to deal with the
overhead of a domain function (Like DSUM)?

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list