title: MySql Trigger Update select sum after insert
body: <p>I have three tables.</p>
  
  <ol>
  <li>Members</li>
  <li>Accounts</li>
  <li>Transactions</li>
  </ol>
  
  <p>I want to update Accounts.AccountBalance with the sum of all Transactions.TransactionAmount after a new transaction is inserted into the Transactions table.</p>
  
  <p>The following code does not seem to work for me.  Any suggestions?</p>
  
  <pre><code>CREATE TRIGGER NewTrigger
      AFTER INSERT ON Transactions
      FOR EACH ROW 
      BEGIN
          UPDATE Accounts SET Accounts.AccountBalance = (
                  SELECT SUM(Transactions.TransactionAmount) 
                      FROM Transactions
                      WHERE Accounts.AccountID=Transactions.AccountID
          )
  </code></pre>