title: Updating table in trigger after update on the same table
body: <p>How can I update table's column in a trigger after update on the same table?
  <br />Here's the trigger:</p>
  
  <pre>
  <code>
  CREATE TRIGGER upd_total_votes AFTER UPDATE ON products_score
  FOR EACH ROW
      UPDATE
          products_score 
      SET
          products_score.votes_total =
              (SELECT
                   (votes_1 + votes_2 + votes_3 + votes_4 + votes_5)
               FROM
                   products_score
               WHERE
                   id = new.id)
  </code>
  </pre>
  
  <p>Now when I update the table like</p>
  
  <pre>
  <code>
  UPDATE products_score SET votes_1 = 5 WHERE id = 0
  </code>
  </pre>
  
  <p>this doesn't work, as I get the following:</p>
  
  <pre>#1442 - Can't update table 'products_score' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.</pre>
  
  <p>So how on earth I can get this to work?</p>