SELECT list is not in GROUP BY clause and contains nonaggregated column … incompatible with sql_mode=only_full_group_by

前端 未结 19 3391
灰色年华
灰色年华 2020-11-22 11:28

AM using MySQL 5.7.13 on my windows PC with WAMP Server

Here my Problem is While executing this query

SELECT *
FROM `tbl_customer_pod_uploads`
WHERE          


        
19条回答
  •  面向向阳花
    2020-11-22 11:56

    Use any one solution

    (1) PHPMyAdmin

    if you are using phpMyAdmin then change the "sql_mode" setting as mentioned in the below screenshot.

    Edit "sql mode" variable and remove the "ONLY_FULL_GROUP_BY" text from the value

    (2) SQL/Command prompt Run the below command.

    SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
    

    (3) Don't use SELECT *

    Use relevant column in SELECT query. relevant means columns, which are either coming in "group by" clause or column with the aggregate function (MAX, MIN, SUM, COUNT etc)


    Important note

    Changes made by using point(1) OR point(2) will not set it PERMANENTLY, and it will revert after every restart.

    So you should set this in your config file (e.g. /etc/mysql/my.cnf in the [mysqld] section), so that the changes remain in effect after MySQL restart:

    Config File: /etc/mysql/my.cnf

    Variable name : sql_mode OR sql-mode

提交回复
热议问题