Table joins

  • Hi All,

    I have two Tables as shown below-

    Details-

    Company Name CEO ID Manager ID

    A 1 11

    B 2 22

    C 3 33

    Names-

    ID Name

    1 Amanda

    2 Ben

    3 Charles

    11 Eric

    22 Mike

    33 Jim

    I need to display the names of CEO and Manager as shown below-

    Company Name CEO ID CEO Name Manager ID Manager Name

    A 1 Amanda 11 Eric

    B 2 Ben 22 Mike

    C 3 Charles 33 Jim

    How to join the two tables?

  • join Details to Names twice.....once for CEO. second for Manager

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • amanspschauhan (7/25/2016)


    Hi All,

    I have two Tables as shown below-

    Details-

    Company Name CEO ID Manager ID

    A 1 11

    B 2 22

    C 3 33

    Names-

    ID Name

    1 Amanda

    2 Ben

    3 Charles

    11 Eric

    22 Mike

    33 Jim

    I need to display the names of CEO and Manager as shown below-

    Company Name CEO ID CEO Name Manager ID Manager Name

    A 1 Amanda 11 Eric

    B 2 Ben 22 Mike

    C 3 Charles 33 Jim

    How to join the two tables?

    This looks like homework. What have you tried so far?

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

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

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