title: Nested select statement in SQL Server
body: <p>Why doesn't the following work?</p>
  
  <pre><code>SELECT name FROM (SELECT name FROM agentinformation)
  </code></pre>
  
  <p>I guess my understanding of SQL is wrong, because I would have thought this would return the same thing as  </p>
  
  <pre><code>SELECT name FROM agentinformation
  </code></pre>
  
  <p>Doesn't the inner select statement create a result set which the outer SELECT statement then queries?</p>