GROUP BY Clause And Contains Non Aggregated Column Error

by Devansh


Posted on 17 Aug 2019 07:08:52 (2 months ago)




When MySQL's only_full_group_by mode is turned on, it means that strict ANSI SQL rules will apply when using GROUP BY. This will be simply solved by changing the sql mode in MySQL by this command.

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

Note:

Changes that we made will not set it PERMANENTLY, and it will revert after every restart.

So for permanent fix you should set this in your config file so that the changes remain in effect after MySQL restart,
Config File: /etc/mysql/my.cnf
Variable name: sql_mode OR sql-mode