Cell 1 = row 1 balance minus row 2 balance

D

Dolphinv4

Hi,

I have a table as below, and I want to create a new column NEW:

Date A/c Balance NEW
1/1/08 ABC 100.00 200.00 (300-100)
1/2/08 DEF 300.00 -100.00 (200-300)
1/3/08 XYZ 200.00 200.00 (0-200)

ie, next row balance minus last row balance. How do i do that?

Thanks,
Dolphin
 
S

scubadiver

SELECT E164src.LiveMonth, E164src.Total AS New, (SELECT Max([Total])
FROM E164src AS temp
WHERE temp.monthID=E164src.monthID+1) AS Old, [new]-[old] as diff
FROM E164src

will do the following:

ID LiveMonth New Old diff
1 Aug 06 1 9 8
2 Sep 06 9 5 -4
3 Nov 06 5
 

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