Wednesday, June 29, 2016

MySQL - Error code 1140



Error Code: 1140. In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'dbname.a.column_name'; this is incompatible with sql_mode=only_full_group_by

In order to resolve this issue, we have to turn off ONLY_FULL_GROUP_BY sql_mode.

  1. Check sql_mode by issue this command:
    SELECT @@sql_mode;
  2. You'll see the output like below:
    ONLY_FULL_GROUP_BY
  3. Now turn off the ONLY_FULL_GROUP_BY by issuing this command:
    SET sql_mode = '';
Done!

No comments:

Post a Comment