title: MySQL key ON DUPLICATE KEY UPDATE column is ambiguous
body: <p>Have the following problem</p>
  
  <pre><code>INSERT INTO statistics_new (SELECT * FROM statistics)
      -&gt; 
      -&gt; ON DUPLICATE KEY UPDATE
      -&gt; 
      -&gt; end_date = IF(end_date &lt; VALUES(end_date), VALUES(end_date), end_date);
  ERROR 1052 (23000): Column 'end_date' in field list is ambiguous
  </code></pre>
  
  <p>When I tried to specify column and table aliases as it recommended in <a href="http://dev.mysql.com/doc/refman/5.0/en/insert-select.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/insert-select.html</a> I had the same result.</p>
  
  <p>Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)</p>
  
  <p>The following query runs without problem :</p>
  
  <pre><code>INSERT INTO statistics_new (SELECT * FROM statistics)
  ON DUPLICATE KEY UPDATE
  end_date = VALUES(end_date)
  </code></pre>