I'm trying to add the Product Name, Product SKU, and Order shipment method, to the Sales Order Grid.

this is how my function looks:

protected function _prepareCollection()
    echo $collection = Mage::getResourceModel($this->_getCollectionClass())
                    'skus'  => new Zend_Db_Expr('group_concat(`sales/order_item`.sku SEPARATOR ",")'),
                    'names' => new Zend_Db_Expr('group_concat(`sales/order_item`.name SEPARATOR ",")'),
                    'shipping_description' => 'shipping_description'
    echo $collection->getSelect();
    return parent::_prepareCollection();

but this gives this error:

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in-group statement is ambiguous

Probably because there are two entitity_ids in the main_table.

Is there a way to fix this?

1 Answer 1



Entity_id is the PK name for many tables. You should specify the table name as well:


also, see: $collection->getSelect() copy-paste the query to mysql so you understand more the underlying issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.