title: Join - Table doesn't exist - SQL
body: <p>Could someone explain to me, why this will work:</p>
  
  <pre><code>select t1.id, t1.age 
  from mytable t1 
  join (select age 
        from mytable 
        group by age) t2 
    on t1.age = t2.age
  </code></pre>
  
  <p>while using t1 in the second part of the join statement like so </p>
  
  <pre><code>select t1.id, t1.age 
  from mytable t1 
  join (select age 
        from t1 
        group by age) t2 
    on t1.age=t2.age
  </code></pre>
  
  <p>gives me an error?</p>
  
  <pre><code>ERROR 1146 (42S02) at line 17: Table '[...].t1' doesn't exist
  </code></pre>
  
  <p>In my actual problem, <code>mytable</code> corresponds to a selection, so I would like to use <code>t1</code> in order avoid having to copy-paste the whole <code>select ... from etc</code> statement into the second part of the join statement.</p>