sql - group_concat and SQLSTATE[HY000]: General error: 1111 Invalid use of group function -
on sales order admin page in magento (though not always) error on page, , see in var/report:
sqlstate[hy000]: general error: 1111 invalid use of group function
select count(distinct main_table.entity_id) `m_sales_flat_order_grid` `main_table` inner join `m_sales_flat_order_item` on `m_sales_flat_order_item`.order_id=`main_table`.entity_id inner join `m_catalog_product_entity_varchar` on (m_catalog_product_entity_varchar.entity_id = `m_sales_flat_order_item`.`product_id`) , `m_catalog_product_entity_varchar`.attribute_id=163 (`m_sales_flat_order_item`.parent_item_id null) , ((group_concat(`m_catalog_product_entity_varchar`.value separator ', ') '%tenzen%')) can shed light on why happens , how fix it?
the problem query group_concat() in where clause. however, don't need group_concat() @ logic.
however, need aggregate bring rows given entity together. requires subquery, suggest rewriting as:
select count(*) (select main_table.entity_id `m_sales_flat_order_grid` `main_table` inner join `m_sales_flat_order_item` on `m_sales_flat_order_item`.order_id = `main_table`.entity_id inner join `m_catalog_product_entity_varchar` on m_catalog_product_entity_varchar.entity_id = `m_sales_flat_order_item`.`product_id` , `m_catalog_product_entity_varchar`.attribute_id = 163 `m_sales_flat_order_item`.parent_item_id null group main_table.entity_id having sum(`m_catalog_product_entity_varchar`.value '%tenzen%') > 0 ) t
Comments
Post a Comment