• You can't do precisely that, but you can have a join with conditional logic, or you could have an inline sub-query in a case statement if you just want one column from the other tables.

    For example:

    select *

    from Table1

    left outer join Table2

    on Table1.Col2 = Table2.Col2

    and Table1.Col1 = 2

    left outer join Table3

    on Table1.Col2 = Table3.Col2

    and Table1.Col1 = 3;

    or

    select *,

    case Col1

    when 2 then

    (select Col3

    from Table2

    where Col2 = Table1.Col2)

    when 3 then

    (select Col3

    from Table3

    where Col2 = Table1.Col2)

    end

    from Table1;

    The first one joins to both tables, but only pulls data from Table2 when Col1 = 2, and only pulls data from Table3 when Col1 = 3.

    The second one pulls one column of data from Table2 or Table3, depending on the value of Col1 in Table1.

    Does that help?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon