Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

How do I join sales/order and sales/order_grid by enrty_id
Jr. Member
Total Posts:  4
Joined:  2012-10-04

There is an ‘oder_channelname’ attribute inside the sales/order_grid table and I need to join it with the sales/order table. Can some please point me in the right direction? Here is what I have so far based on how Magento joined sales/order_item and sales/order, but my join is not working for some reason :(

This is inside: Mage_Sales_Model_Resource_Report_Order_Createdat

$adapter $this->_getWriteAdapter();
$select $adapter->select();
$selectOrderGrid $adapter->select();
$gridCols = array(
'entry_id' => 'entry_id',
'order_channelname' => 'order_channelname'

$selectOrderGrid->from($this->getTable('sales/order_grid'), $gridCols)

$select->from(array('o' => $this->getTable('sales/order')))
join(array('og' => $selectOrderGrid), 'og.entry_id = o.entity_id', array())
where('o.state NOT IN (?)', array(
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top