Q:

How to use group by option for Mage_Core_Model_Resource_Db_Collection_Abstract?

I have non-EAV model which extends Mage_Core_Model_Resource_Db_Collection_Abstract.
This is my code:
$this->getCollection()
        ->removeAllFieldsFromSelect()
        ->removeFieldFromSelect('credit_id')
        ->addFieldToSelect('product_id')
        ->addExpressionFieldToSelect('income', 'SUM({{income}})', 'income');

I need to group by *product_id* but all parents classes doesn't have this function.
Is it possible to group by somehow?

A:

This should work:
$this->getCollection()->getSelect()->group('product_id')

