title: Merge two tables ON DUPLICATE KEY UPDATE only if new value is not null
body: <p>I have to  merge two tables  and update on duplicate key only if new value is not null.
  I tried the code below with no success
  Can anyone help?
  Thanx!</p>
  
  <pre><code>INSERT
  INTO    table1
  SELECT  * FROM    temp  
  ON DUPLICATE KEY UPDATE
    table1.tel = coalesce(temp.tel,table1.tel),
    table1.fax = coalesce(temp.fax,table1.fax)
  </code></pre>