aaron.reese (6/19/2013)
Any idea why the first query does not throw an error?
Because when you have a subquery the tables in both the outer query and subquery are in scope. It's not worrying, it's essential for correlated subqueries (and it's documented behaviour)
The query is probably written incorrectly, but the behaviour its showing (the two rows) is correct for the way the query is written.
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