Questions tagged «join»

1
如何在带有联接查询的magento集合中使用分组依据
在模块的管理网格中,我正在使用此代码来获取集合并将其按客户ID分组 $collection = Mage::getModel('referafriend/statistics')->getCollection(); $collection->getSelect()->group('entity_id'); $this->setCollection($collection); 但是在这里,我必须针对每个客户使用渲染器和过滤器功能来处理客户信息,例如姓名和电子邮件entity_id。我想将客户模型与模块表一起加入。为此,我写了这段代码 $collection = Mage::getModel('customer/customer')->getCollection() ->addNameToSelect(); $collection->getSelect()->join(array('refer' => 'table_name'),'refer.entity_id = e.entity_id' ); $collection->getSelect()->group('entity_id'); $collection->addAttributeToSelect('*'); 但这给了我这个错误 SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in group statement is ambiguous 任何帮助将不胜感激。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.