title: Ambiguous Column Reference with an AS alias
body: <p>I am unsure as to how to resolve an ambiguous column reference when using an alias.</p>
  <p>Imagine two tables, <code>a</code> and <code>b</code> that both have a <code>name</code> column. If I join these two tables and alias the result, I do not know how to reference the <code>name</code> column for both tables. I've tried out a few variants, but none of them work:</p>
  <h3>Attempt 1</h3>
  <pre><code>SELECT a.name, b.name
  FROM (a INNER JOIN b ON a.id = b.id) AS x
  </code></pre>
  <p>This doesn't work as <code>a</code> and <code>b</code> are out of scope.</p>
  <h3>Attempt 2</h3>
  <pre><code>SELECT x.a.name, x.b.name
  FROM (a INNER JOIN b ON a.id = b.id) AS x
  </code></pre>
  <p>SQL syntax doesn't work like that.</p>
  <h3>Attempt 3</h3>
  <pre><code>SELECT x.name, x.name
  FROM (a INNER JOIN b ON a.id = b.id) AS x
  </code></pre>
  <p>That's just plain ambiguous!</p>
  <p>I'm all out of ideas - any help would be much appreciated.</p>