• Ok... let's do this... here's the original data... mark each zero row with the rownum from where it's supposed to get it's data. If you leave any at zero, please explain why... and tell me if I have them sorted correctly... right now, I have them sorted by AOD and Date which met the requirements of your second post.

    RowNum UpdateFrom date Area Amount AOD

    --------- ---------- ----------------------- ---------- ---------- -----------------------

    1 2008-01-01 00:00:00.000 BA 0 2008-01-01 00:00:00.000

    2 2008-02-01 00:00:00.000 BA 50 2008-01-01 00:00:00.000

    3 2008-03-01 00:00:00.000 BA 40 2008-01-01 00:00:00.000

    4 2008-04-01 00:00:00.000 BA 30 2008-01-01 00:00:00.000

    5 2008-05-01 00:00:00.000 BA 20 2008-01-01 00:00:00.000

    6 2008-01-01 00:00:00.000 BA 0 2008-02-01 00:00:00.000

    7 2008-02-01 00:00:00.000 BA 0 2008-02-01 00:00:00.000

    8 2008-03-01 00:00:00.000 BA 30 2008-02-01 00:00:00.000

    9 2008-04-01 00:00:00.000 BA 40 2008-02-01 00:00:00.000

    10 2008-05-01 00:00:00.000 BA 50 2008-02-01 00:00:00.000

    11 2008-01-01 00:00:00.000 BA 0 2008-03-01 00:00:00.000

    12 2008-02-01 00:00:00.000 BA 0 2008-03-01 00:00:00.000

    13 2008-03-01 00:00:00.000 BA 0 2008-03-01 00:00:00.000

    14 2008-04-01 00:00:00.000 BA 20 2008-03-01 00:00:00.000

    15 2008-05-01 00:00:00.000 BA 10 2008-03-01 00:00:00.000

    16 2008-01-01 00:00:00.000 BA 0 2008-04-01 00:00:00.000

    17 2008-02-01 00:00:00.000 BA 0 2008-04-01 00:00:00.000

    18 2008-03-01 00:00:00.000 BA 0 2008-04-01 00:00:00.000

    19 2008-04-01 00:00:00.000 BA 0 2008-04-01 00:00:00.000

    20 2008-05-01 00:00:00.000 BA 20 2008-04-01 00:00:00.000

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)