title: Ambiguous column name SQL error with INNER JOIN: Why?
body: <p>The following code will work to select data from two tables:</p>
  
  <pre><code>SELECT t1.foo, t2.bar FROM TABLE1 t1 INNER JOIN TABLE2 t2 ON t1.foo=t2.foo
  </code></pre>
  
  <p>I could just as easily written</p>
  
  <pre><code>SELECT t2.foo, t2.bar FROM TABLE1 t1 INNER JOIN TABLE2 t2 ON t1.foo=t2.foo
  </code></pre>
  
  <p><code>t1.foo</code> or <code>t2.foo</code>: six of one or half a dozen of the other.  Why not just <code>foo</code>?</p>
  
  <p>I've been wonder why doesn't the SQL server just automatically return the data without me specifying one table or the other since the choice is entirely arbitrary (as far as I can tell).</p>
  
  <p>I can make up a scenario where you would need to specify the table, such as</p>
  
  <pre><code>SELECT t1.foo, t2.bar FROM TABLE1 t1 INNER JOIN TABLE t2 ON t1.foo+=t2.foo
  </code></pre>
  
  <p>However, such scenarios are far from the norm in my experience.</p>
  
  <p>Can anyone enlighten me as to why the language is designed so that I have to make this seemingly arbitrary decision in my code?</p>