title: Summing up the rows
body: <p><img src="https://i.stack.imgur.com/wO3ST.png" alt="enter image description here"></p>
  
  <p>I want to add up the profit of all the rows where 1.a=2.a &amp;&amp; 1.b=2.b &amp;&amp; 1.c=2.c ( The case in first and second row , also in third and fourth ). I wrote the following query but this isn't working . </p>
  
  <p><strong>db.Execute "UPDATE a,b,c,SUM(profit) FROM Sum ORDER BY a"</strong></p>
  
  <p>Query execution gives an error. Here is a sample data, be it six records with four fields each.</p>
  
  <pre><code>ID | a | b | c | d
  ==================
     | 1 | 1 | 1 | 50 
     | 1 | 1 | 1 |100 
     | 1 | 2 | 3 | 54 
     | 1 | 2 | 3 | 46 
     | 1 | 2 | 4 | 50 
     | 1 | 1 | 2 |100
  </code></pre>
  
  <p>The expected result set is 4 records with last 2 being the same</p>
  
  <pre><code>ID | a | b | c | d 
     | 1 | 1 | 1 |150 
     | 1 | 2 | 3 |100 
     | 1 | 2 | 4 | 50
     | 1 | 1 | 2 |100 
  </code></pre>