title: mySql after insert trigger, sum up a value by ID and update another table
body: <p>I have two tables, Entries and mountPanels. What I want to do is when a record is inserted in mountPanels, sum up the panels in that table by the ID of the inserted record, and update the Entries table with that sum (that matches the same ID). </p>
  
  <p>When I try the below AFTER INSERT trigger:</p>
  
  <pre><code>UPDATE Entries SET panels = (SELECT SUM(panels) FROM mountPanels WHERE Entries.EntryID = new.EntryID)
  </code></pre>
  
  <p>It sums up everything, but when I try</p>
  
  <pre><code>UPDATE Entries SET panels = (SELECT SUM(panels) FROM mountPanels WHERE Entries.EntryID = mountPanels.EntryID)
  </code></pre>
  
  <p>It sums up everything correctly by ID, but updates every row. I just want it to update the specific row with the ID that was entered last.</p>