Guest_imported
New member
- Jan 1, 1970
- 0
I have a table with some 20 rows.
Each row has a date and an amount.
A date may appear in more than 1 row.
The table is sorted in descending date.
EG 20010418 100
20010418 50
20010418 75
20010417 100
etc etc
I need to write a procedure to handle row 1
differently from each subsequent row.
Row 1 will have a variable added to it's amount(50 say).
Rows 2, 3 ,..... will then subtract the sum of the
rows above from this starting position.
eg
Return Display
Row 1 100 (+ 50) 150
Row 2 50 50
Row 3 75 00
Row 4 100 -75
etc etc
I will probably need a union, with the 1st select returning
the 1st row, & the 2nd select returning the rest, but I am not clever enough to construct the coding.
Please help
Each row has a date and an amount.
A date may appear in more than 1 row.
The table is sorted in descending date.
EG 20010418 100
20010418 50
20010418 75
20010417 100
etc etc
I need to write a procedure to handle row 1
differently from each subsequent row.
Row 1 will have a variable added to it's amount(50 say).
Rows 2, 3 ,..... will then subtract the sum of the
rows above from this starting position.
eg
Return Display
Row 1 100 (+ 50) 150
Row 2 50 50
Row 3 75 00
Row 4 100 -75
etc etc
I will probably need a union, with the 1st select returning
the 1st row, & the 2nd select returning the rest, but I am not clever enough to construct the coding.
Please help