I am pulling records from
sales_flat_quote using collection and to make the records unique i have applied
group clause on collection. Below is the code.
$collection = Mage::getResourceModel('sales/quote_collection') ->addFieldToFilter('is_active', '1') ->addFieldToFilter('customer_email', array('notnull' => true)); $collection->getSelect()->group('customer_email');
here the problem is by using
group, latest records are getting filter instead i want the older records to get filtered. guys please provide your valuable input on these question.
lets say i am getting below records in collection and lets assume email address's column name is email
1. email@example.com 2. firstname.lastname@example.org 3. email@example.com 4. firstname.lastname@example.org
here when i do
$collection->getSelect()->group('email'); i will get filtered records as below
1. email@example.com 2. firstname.lastname@example.org 3. email@example.com
instead of that i want
1. firstname.lastname@example.org 3. email@example.com 4. firstname.lastname@example.org