Do I need a cursor or a loop?

  • Hello!

    I have the following data in a table...

    Row

    NumberBranchDateMonthForecast

    1112/1/08137735.9383

    2112/2/08157490.9915

    3112/3/08151679.6942

    4112/4/08131353.2023

    5112/5/08141127.7392

    6112/8/08146502.079

    7112/9/08155417.1519

    8112/10/08142867.0229

    9112/11/08128772.6366

    10112/12/08134335.319

    11112/15/082194053.603

    12112/16/082112107.3937

    13112/17/08242405.1526

    14112/18/08225852.6074

    15112/19/08226267.5264

    16112/22/08235365.4186

    17112/23/08229556.3025

    For each branch for each month I need a running accumulation of the forecast so I need the additional column as such...

    Row 1 AFM=Row 1 Forecast

    Row 2 AFM=Row 2 Forecast + Row 1 AFM

    Row 3 AFM=Row 3 Forecast + Row 2 AFM

    Row 4 AFM=Row 4 Forecast + Row 3 AFM

    Row

    NumberBranchDateMonthForecast AccumForcastMonth

    1112/1/08137735.938337735.9383

    2112/2/08157490.991595226.9298

    3112/3/08151679.6942146906.624

    4112/4/08131353.2023178259.8263

    5112/5/08141127.7392219387.5655

    6112/8/08146502.079265889.6445

    7112/9/08155417.1519321306.7964

    8112/10/08142867.0229364173.8193

    9112/11/08128772.6366392946.4559

    10112/12/08134335.319427281.7749

    11112/15/082194053.603194053.603

    12112/16/082112107.3937306160.9967

    13112/17/08242405.1526348566.1493

    14112/18/08225852.6074374418.7567

    15112/19/08226267.5264400686.2831

    16112/22/08235365.4186436051.7017

    17112/23/08229556.3025465608.0042

    It's been forever since I worked with a cursor or loop and everything I read says to stay away from a cursor.

    Any advice is greatly appreciated!

  • I think the answer you want is in the article[/url] featured in today's newsletter and on the front page of the site.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply