Magento join query in collection
Magento join query in collection : A simple join in magento is given as below:
Magento join query in collection Syntax
$collection = Mage::getModel('Module_name/Model_name')->getCollection(); $collection->getSelect()->join( array('table_alias'=> 'table_name'), 'condition', array('columns_name1'));
Magento join query in collection Example
$collection = Mage::getModel('sales/order')->getCollection(); $collection->getSelect()->join( array('order_item'=> 'sales_flat_order_item'), 'order_item.order_id = main_table.entity_id', array('order_item.sku'));
Magento 2 Join Collection Example
Advertisements