title: How to select aggregate fields using query?
body: <p>I'm trying to select 4 field with addselectionfield. from those 4 field 2 are aggregate (sum) fields.
  </p>
  
  <p>I'm doing the following: </p>
  
  <pre><code>            date fromDate = systemDateGet();
              date toDate = (systemDateGet() + 25);
              query          = new Query();
              qbds           = query.addDataSource(tableNum(MyTable));
              qbds.addSelectionField(fieldNum(MyTable, DateField));
              qbds.addSelectionField(fieldNum(MyTable, USDAmountField), SelectionField::Sum);
              qbds.addSelectionField(fieldNum(MyTable, CurrencyNameField));
              qbds.addSelectionField(fieldNum(MyTable, EURAmountField), SelectionField::Sum);
              qbr            = qbds.addRange(fieldNum(MyTable, DateField));
              qbr.value(queryRange(fromDate, toDate));
  
              queryRun       = new QueryRun(query);
  </code></pre>
  
  <p></p>
  
  <p>While debugging I get following select statement in queryRun: </p>
  
  <pre><code>SELECT SUM(EURAmountField) FROM MyTable(MyTable_1)
  WHERE ((DateField &gt;= {ts '2014-04-01 00:00:00.000'}
  AND DateField &lt;= {ts'2014-04-26 00:00:00.000'}))
  </code></pre>
  
  <p></p>
  
  <p>So what is the reason that it selects only the last addSelectionField and what I have to do to get all fields as I have written in the addSelectionFields?</p>