7
I am using the Mysql language and am trying to group a table of professions with the GROUP BY
through the consultation below.
SELECT name, occupation FROM OCCUPATIONS GROUP BY occupation;
But I get this mistake when trying to group the professions.
ERROR 1055 (42000) at line 2: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'run_bcxfn77ibag.OCCUPATIONS.Name' which is not functionally dependent on Columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
The table is very simple and has this format
The table has the columns name
and occupation
.
I understood that the error says something about the record is on formed list.
But when making a brief consultation of the professions, it returns me this:
Why does this happen?
It is true, when I asked the question I did not notice that it had lost its meaning, this happened because the question asks for the names to be shown, but I forgot to mention that it could be in separate consultations. Hank is only Much.
– Jonathas B. C.
@Maniero, can you help me with this mistake? https://answall.com/questions/392025/erro-no-sql-group-by-clause-and-contains-nonaggregated-column-this-is-incompat
– Tiago