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 2008 Forums
 Transact-SQL (2008)
 populating fields with values from previous row

Author  Topic 

melchor010
Starting Member

2 Posts

Posted - 2011-03-01 : 15:37:57
I have a table with the following columns

Row# Start Additions Deductions End
1 1000.00 0.00
2 0.00 1000.00
3 500.00 0.00
4 0.00 30.00

How do I populate the Start and End columns so that the End column will be the result of adding the columns Start, Additions, and Deductions and the Start column will be equal to the value of the End column of the previous row?

Melchor

X002548
Not Just a Number

15586 Posts

Posted - 2011-03-01 : 15:44:42
what tells you the rows are related to each other?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -