title: SQL - using a value in a nested select
body: <p>Hope the title makes some kind of sense - I'd basically like to do a nested select, based on a value in the original select, like so:</p>
  
  <pre><code>SELECT MAX(iteration) AS maxiteration,
         (SELECT column
          FROM   table
          WHERE  id = 223652
                 AND iteration = maxiteration)
  FROM   table
  WHERE  id = 223652;  
  </code></pre>
  
  <p>I get an ORA-00904 invalid identifier error.</p>
  
  <p>Would really appreciate any advice on how to return this value, thanks!</p>