doubt in a group by

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Tue, 04 Dec 2007 4:17 pm

Hello guys, I'm trying to make a selection and fine, however when I put the group by of this error \"ORA-00979: not a GROUP BY expression\" already tried putting other fields in group by but nothing works.


Code: Select all
SELECT TB_ACOES3.CODACAO,TB_ACOES3.ACAO,TB_ETAPAS3.CODETAPA,TB_ETAPAS3.ETAPA
FROM TB_ACOES3,TB_ETAPAS3
WHERE TB_ACOES3.CODACAO=TB_ETAPAS3.CODACAO
GROUP BY TB_ETAPAS3.CODETAPA
daviddominio
Location: GO

David....

Poston Tue, 04 Dec 2007 4:21 pm

Brother, if you take your GROUP BY, will work.
What happens is that you are trying to combine only one column of your select displayed and he doesn't have a group function (SUM, AVG etc) ...

The columns in your select, other than group function, must compulsorily be grouped.
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Poston Tue, 04 Dec 2007 4:40 pm

beleza, Managed by placing in the group by the same select fields.

HOWEVER HE REPEATS SEVERAL TIMES THE FIELD WOULD HE NOT REPEAT, E.G.. COUNT THE STEPS AND NEXT SHOW THE ITEMS EX.

Code: Select all
AÇÃO                            ETAPA
--------------                   ------------------------
NOME AÇÃO                   ETAPA 1
                                     ETAPA 2
                                     ETAPA ...
daviddominio
Location: GO

David....



Return to SQL

Who is online

Users browsing this forum: No registered users and 2 guests