• kalikoi (2/18/2014)


    I have three tables as follows

    TableA

    ------

    Col1 col2 col3

    1 C01 1

    2 C02 2

    3 C03 1

    4 C04 2

    5 C05 3

    6 C06 1

    TableB(here col2 references to col3 from TableA)

    ------

    ID Col1 col2 displayorder

    1 1 1 2

    2 1 2 3

    3 1 3 1

    TableC(here col2 refers to col1 from TableB and col3 refers to col1 from tableA)

    ------

    Col1 col2 col3

    1 1 1

    2 1 2

    3 1 3

    4 1 4

    5 1 5

    6 6 6

    Based on the three tables i need to generate output from TableA as follows

    5 c05

    6 c06

    3 C03

    1 C01

    4 C04

    2 C02

    can anyone help me on this

    Chris is a generous man but he's not always available. Please see the first link under "Helpful Links" in my signature line below for the best way to post your data in the future. Thanks.

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