原文:postgresql--column must appear in the group by clause or be used in an aggregate function

我想得到大于男女平均年龄的人 原表: 在gauss 下执行以下语句: SELECT stname,age,gender,AVG age FROM att test GROUP BY gender HAVING age gt AVG age 报错:column att test .stname must appear in the group by clause or be used in an a ...

2022-01-20 10:55 0 1941 推荐指数:

查看详情

must appear in the GROUP BY clause or be used in an aggregate function

今天在分组统计的时候pgsql报错 must appear in the GROUP BY clause or be used in an aggregate function,在mysql里面是可以的,但是pgsql报错,我去stackoverflow查询了一下,发现有人遇到过和我一样的问题 ...

Fri Nov 09 19:47:00 CST 2018 0 8441
SELECT list is not in GROUP BY clause and contains nonaggregated column

报错如下: 问题出现的原因: MySQL 5.7.5及以上功能依赖检测功能。如果启用了ONLY_FULL_GROUP_BY SQL模式(默认情况下),MySQL将拒绝选择列表,HAVING条件或ORDER BY列表的查询引用在GROUP BY子句中既未命名的非集合列,也不在功能上 ...

Tue Nov 27 22:16:00 CST 2018 0 19191
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM