I am pulling records from sales_flat_quote
using collection and to make the records unique i have applied customer_email
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.
EDIT [Explanation]
lets say i am getting below records in collection and lets assume email address's column name is email
1. abc@abc.com
2. foo@bar.com
3. xyz@xyz.com
4. foo@bar.com
here when i do $collection->getSelect()->group('email');
i will get filtered records as below
1. abc@abc.com
2. foo@bar.com
3. xyz@xyz.com
instead of that i want
1. abc@abc.com
3. xyz@xyz.com
4. foo@bar.com