【发布时间】:2016-03-03 22:59:31
【问题描述】:
我需要将下面的 sql 查询转换成 magento 来获取集合。
SELECT * FROM sales_flat_order LEFT JOIN sales_flat_order_address ON sales_flat_order.entity_id=sales_flat_order_address.parent_id And sales_flat_order_address.store_id!=x;
我试过这个,我知道这是错误的,只是想知道我想做什么,其中“555”是 sql 查询中的 x
$ordercollection = Mage::getModel('sales/order')->getCollection();
$ordercollection->getSelect()->joinLeft(array('sfoa' => 'sales_flat_order_address'),'main_table.entity_id = sfoa.parent_id',array(,=>'sfoa.store_id'));
$ordercollection->addFieldToFilter('store_id',array('neq'=>'555'));
【问题讨论】: