query help

  • I have 2 tables. Based on the Table1 id which is a column in Table2, I would like the following

    Table1

    T1_Id

    1

    2

    3

    4

    Table2

    T2_IDT1_ID Color

    1 3 red

    2 3 blue

    3 1 green

    4 1 orange

    Result

    Just the records 3 and 1 from table1

    Thanks for the help

  • sturner-926343 (10/7/2014)


    I have 2 tables. Based on the Table1 id which is a column in Table2, I would like the following

    Table1

    T1_Id

    1

    2

    3

    4

    Table2

    T2_IDT1_ID Color

    1 3 red

    2 3 blue

    3 1 green

    4 1 orange

    Result

    Just the records 3 and 1 from table1

    What have you tried? Looks like an inner join on t1.T1_id = Table2.T1_ID

  • sturner-926343 (10/7/2014)


    I have 2 tables. Based on the Table1 id which is a column in Table2, I would like the following

    Table1

    T1_Id

    1

    2

    3

    4

    Table2

    T2_IDT1_ID Color

    1 3 red

    2 3 blue

    3 1 green

    4 1 orange

    Result

    Just the records 3 and 1 from table1

    Thanks for the help

    It's tough to understand exactly what you are after.

    Based on what you have written, I would say this (and I am quite sure that this is not your desired solution):

    select * from table1 where t1_id in (1,3)

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

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

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