MySQL uses group by error SQL_MODE = only_full_group_by modifies SQL_MODE in Session in Navicat

tags: Mysql

Check

 select @@sql_mode;

 mysql SQL_MODE results returned by mysql8

Remove the only_full_group_by this SQL_Mode, the operation is as follows:

SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

Then execute the SQL statement will not report an error, this is just modifying SQL_MODE in this connection. When the mysql connection is disconnected, the above setting will be invalid.

UPDATE users,
(
SELECT
  IFNULL( sum( temp_duration ), 0 ) AS total_duration,
  user_id 
FROM
  (
SELECT
  activity_registrations.* 
FROM
  activity_registrations
  LEFT JOIN activities ON activities.id = activity_registrations.activity_id 
WHERE
  area_3 = 441948 
  AND activities.enabled = 1 
  AND checked_out_at IS NOT NULL 
GROUP BY
  join_activity_time,
  activity_registrations.user_id 
ORDER BY
  join_activity_time ASC 
  ) t 
GROUP BY
  user_id 
  ) a 
  SET volunteer_time = total_duration , rank_score = ROUND(total_duration / 3600)
  WHERE
  users.id = a.user_id

The above statement can be successful!

Intelligent Recommendation

Solve MySQL-sql_mode=only_full_group_by error

Specific error: [Err] 1055-Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally depende...

MySQL error: this is incompatible with sql_mode = only_full_group_by

Error scenario Today, I have a project that I just came down on my computer. When I log in to enter the home page, I reported a string of this is incompatible with sql_mode = only_full_group_by error,...

MySQL error [this is incompatible with sql_mode = only_full_group_by]

Report error message: Reporting error Mysql 5.7.5 and above function dependencies. If ONLY_FULL_GROUP_BY is enabled SQL Mode (By default), MySQL will refuse to select a list, the Having condition, or ...

The MySql encountered today uses Group by to de-duplicate the error "MySQL-this is incompatible with sql_mode=only_full_group_by" to record

Borrowing the analysis of this big cow     First, the principle level This error occurs in mysql version 5.7 and above problems that will occur: The default sql configuration of mysql 5.7 ve...

More Recommendation

MySQL error: # 1 of ORDER BY clause is not in GROUP BY sql_mode = only_full_group_by

During MySQL operation, the following errors are often reported: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PRO...

MySQL is using group by query error this is incompatible with sql_mode=only_full_group_by

The specific errors are as follows: the reason: MySQL 5.7.5 and above functions depend on the detection function. If ONLY_FULL_GROUP_BY SQL mode is enabled (by default), MySQL will reject select lists...

MySQL query error: ORDER BY clause is not in GROUP BY.. this is incompatible with sql_mode=only_full_group_by

my situation : Mysql 5.7.21 version runs sql and reports the same error. The same sql runs directly locally without error. However, this error occurs when connecting to Mysql on the server (even runni...

Mysql Group by error: 1055-Expression #1GROUP BY this is incompatible with sql_mode=only_full_group_by

Original link: https://blog.csdn.net/loveliness_peri/article/details/88051316   The reason for the problem: there are more in sql_mode:ONLY_FULL_GROUP_BY Use SQL statements to query this configur...

Solution: MySQL Error 1055: Group by clause; this is incompatible with sql_mode = only_full_group_by

When using MySQL to perform Group By query statement, error: problem causes The SQL standard does not allow the Select list, a Having condition statement, or a grouse in the Group By in the Order by s...

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

Top