• Talvin Singh - Sunday, February 4, 2018 11:12 AM

    not quite.

    what the above code does is links the point ON the id in alphabet table.

    Point can be any number ie see below.

    OrderID Point
    Order1 4
    Order2 12 
    Order3 12
    Order4 12 
    Order5 29 
    Order6 31 
    Order7 49

    I have ordered the list by Point.  therefore it starts with A and checks if there is another equal Point, if so then assign A, else B, checks if theres another Point equal to B, and so on, like below:

    OrderID Point LetterCode
    Order1 4 A
    Order2 12 B
    Order3 12 B
    Order4 12 B
    Order5 29 C
    Order6 31 D
    Order7 49 E

    What do you want done when there are more than 26 different quantities.  Also, two way street here... what is the business reason for wanting to do this (and I mean something more than "It was a requirement that someone gave me", if you don't mind).

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