gpt4 book ai didi

mysql - 错误代码 : 1111. 群组功能使用无效

转载 作者:行者123 更新时间:2023-11-30 22:36:59 27 4
gpt4 key购买 nike

select max(postal_code) from address
where max(postal_code)
IN (select Min(postal_code) from address
group by district
having min(postal_code) <> "" and district <> "" );

谁能告诉我为什么会出现这个错误?

最佳答案

错误在下一行。除了 HAVING 子句

之外,您不能在 WHERE 子句中使用组函数
where max(postal_code) 

您可以尝试像下面这样修改您的查询

select max_postalcode 
from
(
select max(postal_code) as max_postalcode,
Min(postal_code) as min_postal_code
from address
where district is not null
group by district
having min(postal_code) is not null
) xxx
where max_postalcode = min_postal_code;

关于mysql - 错误代码 : 1111. 群组功能使用无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32268863/

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