gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 11:47:52 24 4
gpt4 key购买 nike

<分区>

我收到关于此请求的 MYSQL 5.7 错误。如何解决此错误?

#1055 - Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.c.customers_group_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with 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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com