SQLSACT (11/12/2012)
When using in adding a correlation predicate is redundant?
Written correctly, just about all the time. Please read that blog post and maybe BoL on how the IN function works
Am I on track here?
select T1.Col1 from T1
where T1.Col1 in
(select Col1 from T2 where T2.Col1 = T1.Col1)
No, I gave you the correct form in my previous post.
--2
select T1.Col1 from T1
where T1.Col1 in (select T2.Col1 from T2)
Think about what the IN does with the two columns specified and you should understand why the correlation is completely unnecessary.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability