title: INNER JOIN two tables which were created by UNION ALL in SQL
body: <p>I want to merge to tables with UNION ALL command. Then I want to INNER JOIN the results with another table. I played with the following structure but it does not work:</p>
  
  <pre><code> (Select * from TableA
   UNION ALL
   Select * from TableB)
   INNER JOIN TableC
   ON somekey
  </code></pre>