小编Dan*_*ams的帖子

SELECT列表不在GROUP BY子句中,并包含非聚合列

收到以下错误:

Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'world.country.Code' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Run Code Online (Sandbox Code Playgroud)

运行以下查询时:

select countrylanguage.language, country.code, sum(country.population*countrylanguage.percentage/100)
from countrylanguage
join country on countrylanguage.countrycode = country.code
group by countrylanguage.language
order by sum(country.population*countrylanguage.percentage) desc ;
Run Code Online (Sandbox Code Playgroud)

使用MySQL世界测试数据库(http://dev.mysql.com/doc/index-other.html).不知道为什么会这样.目前正在运行MYSQL 5.7.10.

有任何想法吗???:o

mysql sql aggregate mysql-error-1055

32
推荐指数
2
解决办法
12万
查看次数

标签 统计

aggregate ×1

mysql ×1

mysql-error-1055 ×1

sql ×1