如何解决 SELECT 列表不在 GROUP BY 子句中且包含非聚合的问题?

kur*_*ama 0 mysql mysql-error-1055

我在 MYSQL 5.7 上收到此请求的错误。如何解决这个错误?

#1055 - SELECT 列表的表达式 #3 不在 GROUP BY 子句中,并且包含非聚合列“test.c.customers_group_id”,该列在功能上不依赖于 GROUP BY 子句中的列;这与 sql_mode=only_full_group_by 不兼容

select  SQL_CALC_FOUND_ROWS  c.customers_firstname, 
                             c.customers_lastname, 
                             c.customers_group_id,
                             sum(op.products_quantity * op.final_price) as ordersum 
from customers c,
     orders_products op,
     orders o
where c.customers_id = o.customers_id 
and o.orders_id = op.orders_id 
group by c.customers_firstname, 
         c.customers_lastname 
order by ordersum DESC
Run Code Online (Sandbox Code Playgroud)

小智 5

也包括c.customers_group_id在 group by 子句中