How can I put the value of a previous record field in a query?

G

Guest

I have SQL query with the data as follows
Week Open Created Closed Balanc
09 10 2 5
10 0 3 4
11 0 5 1 1
12 0 4 2 1

and so on..

How can I write a SQL query to get the reult like below

Week Open Created Closed Balanc
09 10 2 5
10 7 3 4
11 6 5 1 1
12 10 4 2 1

In other words Balance = (Open+Created-Closed
The value of Open of the next record should be the balance of the previous record

Please help me solve this problem
 
M

Mike

I had a similar problem that I had posted here. Try
this...

http://support.microsoft.com/default.aspx?scid=kb;en-
us;210504&Product=acc2000
-----Original Message-----
I have SQL query with the data as follows:
Week Open Created Closed Balance
09 10 2 5 7
10 0 3 4 6
11 0 5 1 10
12 0 4 2 12

and so on...

How can I write a SQL query to get the reult like below:

Week Open Created Closed Balance
09 10 2 5 7
10 7 3 4 6
11 6 5 1 10
12 10 4 2 12

In other words Balance = (Open+Created-Closed)
The value of Open of the next record should be the
balance of the previous record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top