title: TSQL Subquery Behavior
body: <p>SQL Server <a href="https://docs.microsoft.com/en-us/sql/t-sql/language-elements/in-transact-sql?view=sql-server-2017" rel="nofollow noreferrer">docs</a> don't indicate a requirement for using table aliases in subqueries, or when not used, the expected behavior.  For example:</p>
  <pre><code>-- create and populate two tables with unique column names
  create table tbl1 (col1 int);
  insert tbl1 values (1);
  create table tbl2 (col2 int);
  insert tbl2 values (2);
  
  -- execute query and subquery 
  select col1 from tbl1 
      where col1 in (select col1 from tbl2);
  </code></pre>
  <p>The subquery alone returns the expected error:</p>
  <pre><code>Invalid column name 'col1'.
  </code></pre>
  <p>But the full query returns a result without raising an error.</p>
  <p><a href="https://i.stack.imgur.com/bL3Hc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bL3Hc.png" alt="query result" /></a></p>
  <p>Is this behavior <strong>officially documented</strong> either by Microsoft or SQL-92 standard?  Thanks!</p>