What query isused to add up the credits until it matches a debit?

M

Michel Walsh

Hi,


SELECT a.dateStamp, SUM(b.amount)
FROM myTable As a INNER JOIN myTable As b
ON a.dateStamp >= b.dateStamp
GROUP BY a.dateStamp




will produce a running sum of the values under the field amount. It is up to
you to write a add a HAVING SUM(b.amount) >0 and make another query that
will call this on, finding the minimum dateStamp for which it occurs
(amount >0 for a credit, amount <0 for a debit ).


If that is not what you have in mind, can you supply more details?



Vanderghast, Access MVP
 
Top