title: SQL Create new row as a sum of multiple rows
body: <p>Supposing I have the following rows:</p>
  
  <pre><code>VARIABLENAME   YYYYMM   XXXXYY   DATAOBS
  variable_1   | 201101 | 111100 | 20
  variable_2   | 201101 | 111100 | 20
  variable_1   | 201102 | 111100 | 30
  variable_2   | 201102 | 111100 | 30
  variable_1   | 201101 | 222211 | 20
  variable_2   | 201101 | 222211 | 20
  variable_1   | 201102 | 222211 | 30
  variable_2   | 201102 | 222211 | 30
  </code></pre>
  
  <p>I would like to know how to get the result:</p>
  
  <pre><code>VARIABLENAME      YYYYMM    XXXXYY   DATAOBS
  variables_1and2 | 201101  | 111100 | 40
  variables_1and2 | 201102  | 111100 | 60
  variables_1and2 | 201101  | 222211 | 40
  variables_1and2 | 201102  | 222211 | 60
  </code></pre>
  
  <p>where all the <strong>DATAOBS</strong> in rows containing <strong>variable_1</strong> and <strong>variable_2</strong> within each respective <strong>YYYYMM</strong> within in each respective <strong>XXXXYY</strong> are added and placed  in a new row, <strong>variables_1and2</strong>, still within their respective <strong>YYYYMM</strong> and respective <strong>XXXXYY</strong>. </p>
  
  <p>If it's necessary to know, there are several hundred different YYYYMM and XXXXYY in the actual data I'm dealing with.</p>
  
  <p>Thanks in advance!</p>