• GilaMonster (11/12/2012)


    Well, those aren't written correctly. The correct form would be

    --1

    select T1.Col1 from T1

    where exists

    (select * from T2 where T2.Col1 = T1.Col1)

    --2

    select T1.Col1 from T1

    where T1.Col1 in

    (select Col1 from T2)

    And those two are completely equivalent.

    http://sqlinthewild.co.za/index.php/2009/08/17/exists-vs-in/

    Thanks Gail

    I think I'm getting there

    When using in adding a correlation predicate is redundant?

    In my own words, using the query below. The subquery has already satisfied what I'm looking therefore rendering the outer query unnecessary.

    Something like select Col1 from table1 where table1 in (select Col1 from table1 )

    Am I on track here?

    select T1.Col1 from T1

    where T1.Col1 in

    (select Col1 from T2 where T2.Col1 = T1.Col1)

    Thanks