Exlusions in calculating a running balance.
Posted on 2013-02-05
I'm calculating a running balance on a column with the amounts of transactions. However, I want the running balance to "skip over" the amounts in the columns with an entry type of savings. I'm having trouble with that part. Here's by running balance and the savings information that needs to be skipped.
(SELECT SUM(C2.AMOUNT) AS Balance
FROM TRANS AS C2
WHERE C2.FacilityID = T.FacilityID
AND C2.N <= T.N
) AS Balance
NOTE: I had this in the first query to get the amount with other statements in a CASE
WHEN BAD.IBS_ENTRY_TYPE BETWEEN '50' AND '99'
AND BAD.IBS_ENTRY_TYPE IN ('92','95')
Would appreciate any help. Thanks