title: How can I insert values from SELECT SUM into other table?
body: <p>I'm stuck and I could use a little input. How can I insert the SUM(amount) of all values of "accountKonto" of table "Buchung" into one row of the table "Erfolg"?</p>
  
  <p>"Buchung": id  accountKonto amount</p>
  
  <p>"Erfolg": id totalAmountAccountKonto1 totalAmountAccountKonto2 …</p>
  
  <p>For each possible "accountKonto" in "Buchung", there is one column in "Erfolg", into which I need to insert the sum. At the end, I need to have one new row in "Erfolg" that should have all sums of "amount" for each "accountKonto" that exists in "Buchung". Makes sense?</p>
  
  <p>It should begin like this:</p>
  
  <pre><code>SELECT SUM(amount) FROM Buchung …
  </code></pre>
  
  <p>But how do I tell it to put each sum into the corresponding field of table Erfolg?</p>
  
  <p>Thanks a lot for your help!</p>
  
  <p>Gary</p>