sql - Why the following error occurs only in PGSQL and not in MYSQL? -
must appear in group clause or used in aggregate function
i doing inner join between 2 tables , used 1 of foreign key in base table within group , above error thrown. works fine in mysql
i believe speaking mysql < 5.7 non standard feature in mysql did away mysql 5.7
please see : https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by
sqlmode_only_full_group_by reject queries select list, having condition, or order list refer nonaggregated columns neither named in group clause nor functionally dependent on (uniquely determined by) group columns.
as of mysql 5.7.5, default sql mode includes only_full_group_by. (before 5.7.5, mysql not detect functional dependency , only_full_group_by not enabled default. description of pre-5.7.5 behavior, see mysql 5.6 reference manual.)
Comments
Post a Comment