I tried to read about not a group by expression errors from some other posts, but all of them mention group functions such as MAX, MIN, etc. I’m not using any of it and it’s a really simple query returning this sort of error.
SELECT *
FROM ad_voarnet_atendimento_pista
WHERE is_closed = 0
GROUP BY prefixo
ORDER BY prefixo
What am I doing wrong here?
Edit:
The expected result is the same that MySQL would give me with this query. It would exclude every duplicated value of the column PREFIXO. I want only 1 record of each value in the mentioned column.
The error message is this:
[Err] ORA-00979: not a GROUP BY expression
The
GROUP BYis not useful outside of the context of an aggregate function likeMIN() MAX() SUM() COUNT(), except perhaps to deduplicate rows. Just remove it. If you are looking to deduplicate results, useDISTINCTinstead. If you useDISTINCT, it won’t be of much value unless you are more specific about the columns in theSELECTlist, excluding the primary key column.GROUP BYis sometimes confused withORDER BY. You already have anORDER BY PREFIX0,