I'm curious as well it seems that if the column is in the outer Table it allows the IN (SELECT) to work
eg
CREATE TABLE #Tmp (
MyColumn Int Identity(1,1),
MyDescription varchar(100)
)
Create Table #Tmp2 (
ACol int
)
Insert into #Tmp
Values ('Hello'),('World'),('Mom')
Insert into #Tmp2
Values (1),(2),(3),(4)
Select MyColumn
from #Tmp
Where MyColumn In (Select MyColumn from #Tmp2)
Select MyColumn
from #Tmp
Where MyColumn In (Select xyz from #Tmp2)
The first select runs the second Errors as xyz isnt in either table, Can anyone explain if this is working as intended.
_________________________________________________________________________
SSC Guide to Posting and Best Practices