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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 please help me calculate advance payment in sql T_

Author  Topic 

jheign02
Starting Member

1 Post

Posted - 2012-04-09 : 19:05:45
i need to make a query that automatically compute advance payments..the excess amount will automatically added to next row..the output goes like this...

id date payment amount
1 3/3/2012 20 20---if the customer pay 50.(50-20=30)
1 3/4/2012 10 10----(30-10=20)
1 3/5/2012 10 10----(20-10=10)
1 3/6/2012 20 10---we have ramaining 10 bal. for this day
1 3/7/2012 20+10=30 0
1 3/8/2012 10 0--and so on

PLEASE HELP ME...

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-10 : 16:16:44
sorry your output is not clear

is the initial payment value (50) input from user?

also till what point you need to keep on accruing the remaining amount to next payment?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -