Mysql版本导致GROUP BY分组异常
一、异常信息
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘ecpnew.m.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
二、数据库版本
版本 1
版本 2(出事版本)
三、SQL
select count(m.material_name) realSorageNumber ,m.*
from tb_material_inventory m
left join
tb_catalog c on m.catalog_buss_key = c.buss_key
where m.catalog_buss_key in (
SELECT
buss_key
FROM
(
SELECT
@ids AS _ids,
( SELECT @ids := GROUP_CONCAT( id ) FROM tb_catalog WHERE FIND_IN_SET( parent_id, @ids ) ) AS cids,
@l := @l + 1 AS LEVEL
FROM
tb_catalog,
( SELECT