Skip to main content
1 of 3
Akhil Gupta
  • 2k
  • 1
  • 17
  • 30

How to sort the order of Magento joinLeft

I am trying to use a join query in Magento Abandoned Grid this way:

 $collection->getSelect()->joinLeft(
                        'abandoned_comment_history', 'main_table.customer_id=abandoned_comment_history.customer_id', array('admin_comment', 'comment_datetime', 'status'))
                ->group('main_table.customer_id');

In my custom table abandoned_comment_history there are multiple matches with main table.customer_id & i am getting the first one but i need last one.

Is there any way to get the last match from my custom table. I searched a lot but couldn't find the solution. Hope will get here.

Akhil Gupta
  • 2k
  • 1
  • 17
  • 30