이 코드는 그리드에 있습니다. order 및 order_address에서 일부 필드를 검색하려고합니다. 내가 쿼리에서 볼 수Magento에서 오류가 발생했습니다.
SELECT `main_table`.`region`, `main_table`.`city`, `order`.* FROM `sales_flat_order_address` AS `main_table` LEFT JOIN `` AS `order` ON order.entity_id = main_table.parent_id WHERE (address_type = 'shipping') AND (region = 'California') GROUP BY `city`
: LEFT JOIN '' AS 'order'
내 조인 생성이 SQL 쿼리를 얻고있다. 그건 맞지 않아. 다음은 쿼리가 생성되는 코드입니다. 어떤 도움도 환영합니다.
$coreResource = Mage::getSingleton('core/resource');
$collection = Mage::getModel('sales/order_address')->getCollection();
$collection
->addAttributeToSelect('region')
->addAttributeToSelect('city')
->addAttributeToFilter('address_type', 'shipping')
->addAttributeToFilter('region', 'California');
$collection->getSelect()->joinLeft(
array('order' => $this->getTable('sales_order')),
'order.entity_id = main_table.parent_id',
array('order.*'))
->group('city');
죄송합니다. 작동하지 않았습니다. – reydelleon