• Eirikur Eiriksson (8/27/2014)


    keshabsingh (8/27/2014)


    This is not homework session. Your approach is very limited with hard coding the values. What if data is like this?

    Then, that in itself is a change to the initial requirements, which mind you are more limited than my hard coded values.;-) The sum of the values indicate a certain sequence could be another hint there who knows?

    It all boils down to the basics, if you are looking for a proper answer, ask a proper question!

    😎

    I thought the OP asked a pretty good question not to mention posting readily consumable data and the expected result. It's our "job" to remember that it's just test data and will vary in real life... just like we sometimes explain to other OPs. 🙂

    --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)