title: UPDATE Same Row After UPDATE in Trigger
body: <p>I want the <code>epc</code> column to always be <code>earnings</code>/<code>clicks</code>. I am using an AFTER UPDATE trigger to accomplish this. So if I were to add 100 clicks to this table, I would want the EPC to update automatically.</p>
  
  <p>I am trying this:</p>
  
  <pre><code>CREATE TRIGGER `records_integrity` AFTER UPDATE ON `records` FOR EACH ROW SET 
  NEW.epc=IFNULL(earnings/clicks,0);
  </code></pre>
  
  <p>And getting this error:</p>
  
  <pre><code>MySQL said: #1362 - Updating of NEW row is not allowed in after trigger
  </code></pre>
  
  <p>I tried using OLD as well but also got an error. I could do BEFORE but then if I added 100 clicks it would use the previous # clicks for the trigger (right?)</p>
  
  <p>What should I do to accomplish this? </p>
  
  <p>EDIT - An example of a query that would be run on this:</p>
  
  <pre><code>UPDATE records SET clicks=clicks+100
  //EPC should update automatically
  </code></pre>