How to show when loan was paid off
3
votes
1
answer
293
views
First time posting but have been a reader for over 10 years. I have a need to show when a loan was paid off regardless of the rolling balance from refinancing/taking out additional loans.
In the other column I want to show pay down balance like
950.00, 850.00, 800.00, 720.00 until I get to zero balance for the LOAN_ID 215, After which I want to then apply remaining payments to LOAN_ID 431
I'm using SQL Server 2005/2008.
Here is my table:
CUST_ID LOAN_ID PMNT_ID PMNT_AMT PMNT_DT LOAN_AMT LOAN_FUND_DT PMNT_RUN_TOT
1155 215 100 100.00 02/15/2015 1050.00 01/15/2015 100.00
1155 215 101 100.00 03/15/2015 1050.00 01/15/2015 200.00
1155 215 102 50.00 03/31/2015 1050.00 01/15/2015 250.00
1155 215 103 90.00 04/15/2015 1050.00 01/15/2015 340.00
1155 215 104 150.00 04/25/2015 1050.00 01/15/2015 490.00
1155 215 105 120.00 05/15/2015 1050.00 01/15/2015 610.00
1155 431 106 100.00 05/25/2015 2100.00 05/20/2015 710.00
1155 431 107 100.00 06/15/2015 2100.00 05/20/2015 810.00
1155 431 108 100.00 06/30/2015 2100.00 05/20/2015 910.00
1155 431 109 100.00 07/15/2015 2100.00 05/20/2015 1010.00
1155 431 110 100.00 08/15/2015 2100.00 05/20/2015 1110.00
1155 431 111 100.00 09/15/2015 2100.00 05/20/2015 1210.00
1155 431 112 100.00 09/30/2015 2100.00 05/20/2015 1310.00
1155 431 113 100.00 10/15/2015 2100.00 05/20/2015 1410.00
The first loan was paid off with
PMNT_ID 110
and 60.00 was rolled over into the pay down of 2100.00 loan. Here is how the output should look
cust_id|loan_id | loan_amount | Loan Bal |paid_off_date
----------------------------------------------------
1155 | 215| 1050 | 0.00 |2015-08-15
1155 | 431| 2100 | 1800.00 |null
Any suggestions on how to show this in another column called "Bal_Pay_Down" ?
Asked by CJack
(41 rep)
Jul 25, 2016, 08:04 PM
Last activity: Apr 7, 2021, 06:11 PM
Last activity: Apr 7, 2021, 06:11 PM