mysql error 1140 In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregate

tags: Mysql

In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column'szmz_zhbz_gov.b.cremation_time'; this is incompatible with sql_mode=only_full_group_by

After reviewing the information, we learned that group by has been optimized after MySQL version 5.7. By default, the improved version starts the ONLY_FULL_GROUP_BY mode.

That is, ONLY_FULL_GROUP_BY is a sql_mode provided by the MySQL database. This sql_mode is used to ensure the validity of the SQL statement "grouping for the most value". This mode adopts the processing method with Oracle, DB2 and other databases. That is, columns with ambiguous semantics are not allowed in the select target list.

Solution:

As long as there are aggregate functions sum(), count(), max(), avg(), etc., you need to use group by

Intelligent Recommendation

ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregate

When mysql 5.7 first uses group by, an error occurs. First, the table information is as follows:        ERROR 1055 (42000): Expression #2 of SELECT list is not in GR...

Given: In aggregated query without GROUP BY, expression # 1 of SELECT list contains nonaggregated column

sql statement error contents: Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: In aggregated query without GROUP BY, expression #1 of SELECT list contains non...

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate

1. Reason Such an error in aggregate query is because the mode set by mysql contains ONLY_FULL_GROUP_BY Two, modify Modify in the configuration file   Then restart the service   Three, cause...

MySQL || Removement: in aggregated query without group by, expression # 1 of success list contains nonaGregate

Shatter Brother Meng, I Hu Han San is coming back again (.. ∀ ·) ノ゙ ノ゙¯ ▽ ¯ *) § First, the problem description Today, I do SQL in the cow passenger net: the course of the...

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test1.p.type_id' which is not functionally dependent on columns in GROUP BY clause; this i...

More Recommendation

Error 1140: In aggregated query without GROUP BY,sql_mode=only_full_group_by

There is no problem running on MySQL 5.5.27. The error of sql_mode=only_full_group_by is reported on MySQL 5.7.24: Error 1140: In aggregated query without GROUP BY, expression #1 of SELECT list contai...

Use mysql DISTINCT function, given ERROR 1140 (42000): In aggregated query without GROUP BY .....

phenomenon: Performing sql SELECT COUNT (DISTINCT (colum1)), colum2, colum3 FROM table; error ERROR 1140 (42000): In aggregated query without GROUP BY ..... the reason: sql_mode default mysql opens up...

Mysql error: In aggregated query without GROUP BY

【phenomenon】 【solve】...

MySQL error in aggregated query without group by

Execute a statement: select de.dept_no, count(s.salary) from salaries s left join dept_emp de on s.emp_no = de.emp_no; Complete error message: In aggregated query without GROUP BY, expression #1 of SE...

mysql reports an error when using GROUP BY to group: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggre

the reason MySQL 5.7.5 and above functions depend on the detection function. If ONLY_FULL_GROUP_BY is enabled SQL mode (by default), MySQL will reject the select list, HAVING condition or ORDER BY lis...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top