Add a 'GROUP BY' in Views?
Views 3 supports grouping.

For views 2, aside of Views Group By, you can also write a custom module, implement hook_views_query_alter(&amp;$view, &amp;$query) and do something like:

function MYMODULE_views_query_alter(&amp;$view, &amp;$query) {
  if ($view-&gt;name == 'view_name') {
    if ($view-&gt;current_display == 'page_XXXXXX') {
      // Tell the query constructor these fields must be used with the GROUP BY clause
      $query-&gt;add_groupby('field1');
      $query-&gt;add_groupby('field2');

      // hack to make the query constructor just ignore these fields (not adding them to the GROUP BY clause. It's needed to let it continue without problems
      $query-&gt;fields['fieldalias3']['aggregate'] = TRUE;
      $query-&gt;fields['fieldalias4']['aggregate'] = TRUE;
      // ... all but the grouped and aggregated fieldaliases must have this.

      // Configure the fields that perform the aggregation (SUM, AVG, etc)
      $query-&gt;fields['aggregatedfieldaliasA']['table'] = '';
      $query-&gt;fields['aggregatedfieldaliasA']['field'] = "SUM(fieldA)";
    }
  }
}


You now should be able to see the resulting query in the preview when editing the view and make sure it is correct. Field aliases in the code refer to "SELECT table.field1 as fieldalias1 ...", it's easy to get them just by checking the query shown in the preview.