title: can't update table in stored function/trigger because it is already used by statement
body: <p>I have created a trigger in my database to fire after update. I get an error message pop up when I try to update a field. </p>
  
  <blockquote>
    <p>can't update table in stored function/trigger because it is already
    used by statement which invoked this stored function/trigger</p>
  </blockquote>
  
  <p>Here is mysql. I have added it to the Triggers section</p>
  
  <pre><code>UPDATE SiteStaff p, (SELECT StaffID, SUM(Holiday) as mysum
   FROM SiteStaff GROUP BY StaffID) as s
  
      SET p.Total = s.mysum
      WHERE p.StaffID = s.StaffID
  </code></pre>
  
  <p>I guess it is because for some reason the trigger executes but doesn't close once done?</p>