Jump to content
Fórum Script Brasil
  • 0

ERRO ORA-00979: não é uma expressão GROUP BY


André Sena da Silva
 Share

Question

Estou tentando faze uma query que retorne a soma das notas agrupada em um group by atraves de um sub select e esta dando o seguite erro: ORA-00979: não é uma expressão GROUP BY

SELECT EXTRACT(MONTH FROM DTFATUR) AS MES,

EXTRACT(YEAR FROM DTFATUR) AS ANO,
ITE.CODVEND,
VEN.APELIDO,
SUM(VLRNOTA) AS VALORNOTA,
(
SELECT
SUM(CAB2.VLRNOTA) AS VALORNOTA
FROM TGFCAB CAB2
WHERE CAB2.DTFATUR = CAB.DTFATUR
GROUP BY EXTRACT(YEAR FROM CAB2.DTFATUR)
)
AS VRLTOT_ANO
FROM TGFCAB CAB
INNER JOIN TGFITE ITE ON (ITE.NUNOTA = CAB.NUNOTA)
INNER JOIN TGFVEN VEN ON (VEN.CODVEND = ITE.CODVEND)
WHERE DTFATUR BETWEEN '01/01/2015' AND '05/01/2015'
GROUP BY EXTRACT(MONTH FROM DTFATUR),
EXTRACT(YEAR FROM DTFATUR),
ITE.CODVEND, VEN.APELIDO
ORDER BY ITE.CODVEND,
EXTRACT(YEAR FROM DTFATUR),
EXTRACT(MONTH FROM DTFATUR);
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...