Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rajnidas
Yak Posting Veteran
97 Posts |
Posted - 2014-09-12 : 01:37:30
|
hi all,SELECT debit.ACCOUNT_NO, debit.Serviced_Amt,credit.Tran_Amt,credit.Serviced_FlagFROM tbl_Interest_Debit as debitinner join tbl_Credit as crediton debit.ACCOUNT_NO=credit.Account_Noorder by credit.TRANSACTION_VALUE_DATEgetting result-------------------ACCOUNT_NO Serviced_Amt Tran_Amt Serviced_Flag------------ --------------- ------------ ------------45505000661 1013088.00 19157467.00 045505000661 1013088.00 18988.96 033105126375 286533.00 171084.00 033105126375 286533.00 500000.00 033105126375 286533.00 1000000.00 033105126375 286533.00 800000.00 033105126375 286533.00 1000000.00 033105126375 286533.00 1000000.00 0I want that service_amount should be subtracted from tran_amt until service_amount become zero Once service_amount becomes zero service_flag should be changed to 1. using with cursor kindly need helpthanks Rajnidas |
|
Arun Babu N
Starting Member
26 Posts |
Posted - 2014-09-12 : 03:13:38
|
post the expected result outputArun Babu N |
|
|
rajnidas
Yak Posting Veteran
97 Posts |
Posted - 2014-09-12 : 05:00:59
|
i need result is given belowACCOUNT_NO Serviced_Amt Tran_Amt Serviced_Flag------------ --------------- ------------ ------------45505000661 0 19157467.00 145505000661 0 18988.96 133105126375 0 171084.00 133105126375 0 500000.00 133105126375 0 1000000.00 133105126375 0 800000.00 1thanks rajnidas |
|
|
|
|
|