title: INSERT ... ON DUPLICATE KEY UPDATE Statement
body: <p>There's my query :</p>
  <pre><code>INSERT INTO qualification_score 
     (qualification_score.Name, qualification_score.value , qualification_score.date_calcule, qualification_score.customers_id)
     SELECT
          'montant',
          c.somme_achats,
          c.calc_date,
          c.customer_id
      FROM
          customer_info c,
          qualification_score s  
      WHERE 
      c.customer_id = s.customers_id
      ON DUPLICATE KEY UPDATE qualification_score SET qualification_score.value = (SELECT SUM(o.total_paid) FROM orders o 
                         INNER JOIN order_states ON o.current_state = order_states.id
                         WHERE qualification_score.customer_id=o.customer_id AND order_states.invoice = 1)'''
  </code></pre>
  <p>This is the error:</p>
  <blockquote>
  <p>You have an error in your SQL syntax; check the manual that
  corresponds to your MariaDB server version for the right syntax to use
  near 'SET qualification_score.value = (SELECT SUM(o.total_paid) FROM
  orders o</p>
  </blockquote>