Viewing 11 posts - 16 through 26 (of 26 total)
drew.allen (8/11/2016)
;
WITH totals AS (
SELECT *, ABS(Amount) AS Amt, SUM(ABS(Amount)) OVER(PARTITION BY Customer, TransactionType ORDER BY Date ROWS UNBOUNDED PRECEDING...
August 12, 2016 at 1:53 pm
J Livingston SQL (8/11/2016)
--code based on ChrisM fine work at http://www.sqlservercentral.com/Forums/Topic1731617-391-1.aspx
CREATE TABLE #t1
(TransactionID INT,
Customer INT,
TransactionType...
August 11, 2016 at 6:40 pm
pietlinden (8/10/2016)
So you would apply the new payment to the...
August 10, 2016 at 5:32 pm
pietlinden (8/10/2016)
You're doing FIFO (a queue), but with money. So the oldest debt gets paid first, and if there's any...
August 10, 2016 at 1:17 pm
pietlinden (8/9/2016)
August 9, 2016 at 11:51 pm
pietlinden (8/9/2016)
It's doing a running total. It's a typical use of windowing functions... took it straight out of...
August 9, 2016 at 11:31 pm
jssashank (8/9/2016)
pietlinden (8/9/2016)
How...
August 9, 2016 at 10:09 pm
pietlinden (8/9/2016)
August 9, 2016 at 10:07 pm
pietlinden (8/9/2016)
How is...
August 9, 2016 at 9:07 pm
Orlando Colamatteo (8/9/2016)
Your expected...
August 9, 2016 at 8:23 pm
@pietlinden I tried that. But the problem occurs when in a situation where the there is a partial debit between two credits (last example
TransactionID 7 and 9 should...
August 9, 2016 at 8:13 pm
Viewing 11 posts - 16 through 26 (of 26 total)